a-d-s-r

1.1.0 • Public • Published

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.

Dependents (8)

Package Sidebar

Install

npm i a-d-s-r

Weekly Downloads

3

Version

1.1.0

License

MIT

Unpacked Size

2.38 kB

Total Files

3

Last publish

Collaborators

  • coleww