- From: s p <sebpiq@gmail.com>
- Date: Mon, 30 Mar 2015 17:10:45 +0300
- To: "public-audio@w3.org" <public-audio@w3.org>
- Message-ID: <CAGKuoCX4X77yuHosgrrwH31kzL_8Thw9-KRbYgy1otV4t_ghNg@mail.gmail.com>
Hi all! In the past days I've struggled to get an oscillator that would output an exact sawtooth. The use case for me is to modulate an AudioParam and the approximative sawtooth provided by the OscillatorNode is not precise enough. For example, I wanted to loop through a sound file, using WaveShaperNode, and drive the read position in that file with a sawtooth, but since the decrease after the top of the sawtooth is not instant, you can hear a very loud artifact when you reach the end of the file (peak of the saw), a bit like fast rewind. There is 2 solutions I thought about to get this working (I wont mention the 3rd one, it's too ugly). First using the OscillatorNode with a custom wave shape, but I didn't even try because I know I will never get something clean enough, since the wave shape is specified in the frequency domain. Second, using BufferSourceNode, and I was sure it would work. I created a buffer with my wave shape, which I loop, and I control the frequency through directly modulating playbackRate. Turns out this doesn't work on Chrome and is glitchy on Firefox. http://jsfiddle.net/gh144L2u/ I think it would be great to have a way to do this, in order to have a fully predictable wave shape if needed. Is this an intended use-case for BufferSourceNode? In that case I believe the spec is not precise enough about how playbackRate should be handled. Paul Adenot told me that in Firefox the BufferSourceNode is not optimized for fast playbackRate changes, and also playbackRate is a k-rate param which might be alright ... Is this rather a use-case for OscillatorNode? This would require a new param... etc ... Any thoughts on this? -- *Sébastien Piquemal* -----* @sebpiq* ----- http://github.com/sebpiq ----- http://funktion.fm
Received on Monday, 30 March 2015 14:11:16 UTC