rserota / wad

Web Audio DAW. Use the Web Audio API for dynamic sound synthesis. It's like jQuery for your ears.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

setRate does not appear to work.

alittlebitweird opened this issue · comments

When calling setRate with any parameters, the rate is set to 1.

That is the intended behavior, though I guess it could be documented a bit better.

If you want to change the rate of a wad that isn't currently playing, simply assign it a new rate: myWad.rate = 2.
If you want to play a wad once with a specific rate, you can pass it in to play: myWad.play({rate:2}).
The setRate() method is intended to be used on a wad that is currently playing. For example, you might set up a mod wheel on a MIDI keyboard to call setRate() on a wad, to play around with audio clips in real-time.

@rserota thanks for clearing that up. Can this be done the same way for filters?

If you want to change the filters of a wad that isn't playing, you can just assign to the filters property. If you want to change the frequency of a Wad that's currently playing, there isn't a very elegant way to do this yet, but it's possible: myWad.nodes[1].frequency.linearRampToValueAtTime(500, Wad.audioContext.currentTime, .1)
Though you'd have to know the index of the filter node in the Wad's node list.