- From: s p <sebpiq@gmail.com>
- Date: Sun, 29 Mar 2015 13:11:34 +0300
- To: public-audio-dev@w3.org
- Message-ID: <CAGKuoCWWNFaL08Yu8O0JBViMPbh2Qd4+JhFDvCdSdcdOAwSf8A@mail.gmail.com>
Hi all, I have some code which I believe should work, but it doesn't ... var context = new AudioContext() , phasorNode = context.createBufferSource() , frequencyNode = context.createBufferSource() , bufferFrequency = context.createBuffer(1, context.sampleRate, context.sampleRate) , arrayFrequency = bufferFrequency.getChannelData(0) , bufferRamp = context.createBuffer(1, context.sampleRate, context.sampleRate) , arrayRamp = bufferRamp.getChannelData(0) , acc = 0, step = 1 / context.sampleRate, i for (i = 0; i < arrayRamp.length; i++) { arrayRamp[i] = (acc % 1) acc += step } for (i = 0; i < arrayFrequency.length; i++) { arrayFrequency[i] = 200 } phasorNode.buffer = bufferRamp phasorNode.connect(context.destination) phasorNode.loop = true phasorNode.start(0) frequencyNode.buffer = bufferFrequency frequencyNode.connect(phasorNode.playbackRate) frequencyNode.loop = true frequencyNode.start(0) Basically, the idea is I am trying to build a perfect sawtooth. The "phasorNode" is just a ramp that is looped, and I would control the sawtooth frequency by changing the value of playbackRate. However I want to control this frequency by using another AudioNode (frequencyNode). It works if I set the playbackRate by using setValueAtTime, but the frequencyNode seems to have no effect ... I really don't see why this doesn't work, but it doesn't ... so if somebody has an explanation, I'd love to hear it :) -- *Sébastien Piquemal* -----* @sebpiq* ----- http://github.com/sebpiq ----- http://funktion.fm
Received on Sunday, 29 March 2015 10:12:02 UTC