AudioBuffer

var audioctx = new (window.audiocontext || window.webkitaudiocontext)(); var myarraybuffer = audioctx.createbuffer(2,audioctx.samplerate *3, audioctx.samplerate); for (var channel =0; channel < myarraybuffer.numberofchannels; channel++){ var nowbuffering = myarraybuffer.getchanneldata(channel); for (var i = 0; i < myarraybuffer.length; i++){ nowbuffering[i] = math.random()*2-1; } } var source = audioctx.createbuffersource(); source.buffer = myarraybuffer; source.connect(auduoctx.destination); source.start();
The following simple example shows how to create an AudioBuffer and fill it with random white noise. You can find the full source code at our webaudio-examples repository; a running live version is also available.

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.