Re: Web Audio API ambient drone

Hey Matt-

Neat!  I like the apparent pitch generated by bandpass filter.

One comment - instead of continually generating noise via
JavaScriptAudioNodes, you'd probably find it much more performant to
pre-generate a couple of seconds (to avoid any detectable periodicity) of
noise in a Buffer and playing it as an AudioNode.  That would probably be a
bit more performant than continually calling Math.random for each sample.

var lengthInSamples =  2 * audioContext.sampleRate;
var noiseBuffer = audioContext.createBuffer(1, lengthInSamples,
audioContext.sampleRate);
var bufferData = noiseBuffer.getChannelData(0);
for (var i = 0; i < lengthInSamples; ++i) {
    bufferData[i] = (2*Math.random() - 1);
}

On Sat, Jul 14, 2012 at 12:26 PM, Matt Diamond <mdiamond@jhu.edu> wrote:

> Hey all,
>
> Put together a little experiment in synthesizing an ambient sound texture
> using the Web Audio API:
>
> http://matt-diamond.com/drone.html
>
> Matt
>

Received on Sunday, 15 July 2012 15:03:37 UTC