W3C home > Mailing lists > Public > public-audio@w3.org > January to March 2012

Advice on the convolver node

From: Chris Lowis <chris.lowis@bbc.co.uk>
Date: Tue, 20 Mar 2012 16:30:02 +0000
Message-ID: <4F68B08A.9070602@bbc.co.uk>
To: public-audio@w3.org
Hi!

I've been playing around with the convolver node in the Web Audio API. 
The examples I could find load an impulse response into the convolver 
node by making an XHR request to a URI to a wav file, e.g. (from [1]):

function loadImpulseResponse(url, convolver) {
     var request = new XMLHttpRequest();
     request.open("GET", url, true);
     request.responseType = "arraybuffer";

     request.onload = function() {
         convolver.buffer = context.createBuffer(request.response, false);
         isImpulseResponseLoaded = true;
     }
     request.onerror = function() {
         alert("error loading reverb");
     }

     request.send();
}

var convolver = context.createConvolver();
loadImpulseResponse('impulse-responses/matrix-reverb6.wav', convolver);


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()?

Best regards,

Chris

[1] - 
http://chromium.googlecode.com/svn/trunk/samples/audio/wavetable-synth.html


-- 
Chris Lowis
Research Engineer, BBC R&D (Central Labs)
7th Floor, Henry Wood House, 3-7 Langham Place, London. W1A 1AA
Tel: 020 7765 0854
Received on Tuesday, 20 March 2012 16:29:58 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 20 March 2012 16:29:58 GMT