var audioctx = new (window.audiocontext || window.webkitaudiocontext)();
var reverb = audioctx.createconvolver();
...
function base64toarraybuffer(base64){
var binarystring = window.atob(base64);
var len = binarystring.length;
var bytes = new uint8array(len);
for (var i = 0; i < len; i++) {
bytes[i] = binarystring.charcodeat(i);
}
return bytes.buffer;
}
...
var reverbsoundarraybuffer = base64toarraybuffer(impulseresponse);
audioctx.decodeaudiodata(reverbsoundarraybuffer,function (buffer){
reverb.buffer = buffer;
},
function(e){
alert('error when decoding audio data' + e.err);
})
The ConvolverNode interface is an AudioNode that performs a Linear Convolution on a given AudioBuffer, often used to achieve a reverb effect. A ConvolverNode always has exactly one input and one output.
Be the first to comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.