- From: Raymond Toy <rtoy@google.com>
- Date: Tue, 20 Mar 2012 10:18:25 -0700
- To: Chris Lowis <chris.lowis@bbc.co.uk>
- Cc: public-audio@w3.org
Received on Tuesday, 20 March 2012 17:18:57 UTC
On Tue, Mar 20, 2012 at 9:30 AM, Chris Lowis <chris.lowis@bbc.co.uk> wrote: > > My question - is it possible to set the convolver buffer from a regular > javascript array? For example to generate the impulse response using > Math.sin()? > > Yes, you can do this. Something like the following should work: var convolver = context.createConvolver(); convolver.buffer = myImpulseResponse(); where myImpulseResponse can be something like: function myImpulseResponse() { var audioBuffer = context.createBuffer(1, sampleFrameLength, context.sampleRate); var n = audioBuffer.length; var data = audioBuffer.getChannelData(0); <fill data array with your desired impulse response> return audioBuffer; } Ray
Received on Tuesday, 20 March 2012 17:18:57 UTC