Re: Advice on the convolver node

On Thu, Mar 22, 2012 at 3:18 AM, Chris Lowis <chris.lowis@bbc.co.uk> wrote:

> 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.
>

If your impulse response is a 30Hz sine wave, consider what happens in the
frequency domain.  You transform the input signal and transform your 30Hz
sine.  The transform of that is a narrow spike at 30 Hz.  Multiply the
transforms together and you get a narrow spike at 30Hz.  Inverse transform
to get the desired signal.  All you get out would be a 30Hz sine wave, at
most.

One possible way to do your time domain multiplication is to use an audio
gain node with a setValueCurveAtTime.  Use your 30Hz sine wave as the curve
and feed your input into the gain node.  This should multiply your signal
by your 30Hz sine.


>
> 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.
>

This should work.  But note that there is an internal normalization going
on.  If you want just straight convolution, you should set the normalize
attribute to false.

Ray

Received on Thursday, 22 March 2012 17:00:18 UTC