- From: s p <sebpiq@gmail.com>
- Date: Sun, 29 Mar 2015 17:07:33 +0300
- To: Chinmay Pendharkar <notthetup@gmail.com>
- Cc: "public-audio-dev@w3.org" <public-audio-dev@w3.org>
- Message-ID: <CAGKuoCUyxYE=_ZK4sjyeKYQH7jLrbXpfPrsYDc37P4W6wx3cSw@mail.gmail.com>
> There was something tricky about getting a "DC" signal out of an AudioNode. What do you mean? More tricky than that : https://github.com/sebpiq/WAAOffsetNode/blob/master/lib/WAAOffsetNode.js ? I've been using the above as a DC for different uses, and it always worked well. This is basically the same implementation as what I gave in the code snippet I posted. I use it here for example http://sebpiq.github.io/WAATableNode/demos/cello-drone.html to add an offset to an oscillator, in order to obtain a triangle wave between 0 and 1. Using a WaveShaper to create this perfect sawtooth instead of what I tried above is a good idea ... however I'd still want to understand why the above snippet doesn't work :( On Sun, Mar 29, 2015 at 4:16 PM, Chinmay Pendharkar <notthetup@gmail.com> wrote: > 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) >> > > > -- *Sébastien Piquemal* -----* @sebpiq* ----- http://github.com/sebpiq ----- http://funktion.fm
Received on Sunday, 29 March 2015 14:08:01 UTC