Thanks to visit codestin.com
Credit goes to github.com

Skip to content

coleww/a-d-s-r

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

a-d-s-r

given a gainNode, does the ADSR dance

NPM Build Status

API

adsr(gainNode, when/time/ac.currentTime(probably), adsrObject:{attack, decay, sustain, release, peak, mid, end})

EXAMPLE

var AudioContext = AudioContext || webkitAudioContext
var ac = new AudioContext()
var gain = ac.createGain()

// other stuff, make an oscillator, idk, do u

adsr(gain, ac.currentTime, {attack: 0.25, decay: 0.1, sustain: 0.2, release: 0.05, peak: 0.7, mid: 0.5, end: 0.000001})

WOW, COOL!

starting at the passed time (2nd arg) 
the adsr function will take the gain of the gain node 
from whatever it is at to the peak volume in attack time,
then down to the mid in decay time,
then chill at the mid for sustain time,
then go down to 0 after release time.

About

📉 does the ADSR dance on a Web Audio gainNode

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published