Re: Advice on the convolver node

On 20/03/2012 17:18, Raymond Toy 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:

Hi Raymond,

Thank you for your advice! I've been trying to get to grips with the 
convolver node by reading the source in Webkit, but I'm having a little 
trouble understanding whether I can do what I want with it.

I'm attempting to create a "ring modulation" effect. In the time domain 
I'd like to multiply the input signal (an audio buffer node) with a 30Hz 
sine wave. I thought I could achieve the same in the frequency domain 
using a convolution.

I have something like

   convolver = context.createConvolver()
   loadImpulseResponse('sine_30hz.wav', convolver, context);
   source.connect(convolver)
   convolver.connect(context.destination)

Where sine_30hz.wav is a single-channel, 30Hz sine wave of 5 seconds in 
duration. The source is a audio buffer node. I've reverted to loading 
the "impulse response" using an XMLHttpRequest to make sure I'm not 
doing something stupid.

When I load the "echo-chamber.wav" impulse response from the demos 
repository I get the expected result. When I use my 30Hz Sine wav, just 
silence.

Am I missing something here? The documentation of the Convolution node 
suggests that it is operating as a FIR filter, I'm not quite sure 
whether it is possible to do a straight convolution with this node.

Thank you again for your help!

Cheers,

Chris

Received on Thursday, 22 March 2012 10:18:49 UTC