- From: Chinmay Pendharkar <notthetup@gmail.com>
- Date: Sun, 29 Mar 2015 21:16:57 +0800
- To: s p <sebpiq@gmail.com>
- Cc: "public-audio-dev@w3.org" <public-audio-dev@w3.org>
- Message-ID: <CAJw8Xip28yU8ATDCvhW4OcuLpTR1FfRAKBhFQb+++8ExZrJz_w@mail.gmail.com>
Ah yes! I remember a discussion on this issue before. There was something tricky about getting a "DC" signal out of an AudioNode. I keep thinking it was Soledad who was talking about it. Don't quite remember what why it was behaving this way. The other option is look at what Yotam is doing with Tone.js. He has an entire 'signalling' system based on such "DC" signals. https://github.com/TONEnoTONE/Tone.js/tree/master/Tone/signal I believe he generates by passing an osc through a wave shaper. https://github.com/TONEnoTONE/Tone.js/blob/master/Tone/signal/Signal.js#L346 -Chinmay On Sun, Mar 29, 2015 at 6:11 PM, s p <sebpiq@gmail.com> wrote: > 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) >
Received on Sunday, 29 March 2015 13:17:54 UTC