Created
February 28, 2013 02:34
-
-
Save kevincennis/5053725 to your computer and use it in GitHub Desktop.
White noise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sr = 48e3 | |
, sec = 5 | |
, len = sr * sec | |
, ctx = new webkitAudioContext() | |
, arr = new Float32Array(len) | |
, buf = ctx.createBuffer(1, len, sr) | |
, src = ctx.createBufferSource() | |
, i = 0 | |
for ( ; i < len; ++i ) arr[i] = Math.random() | |
buf.getChannelData(0).set(arr) | |
src.buffer = buf | |
src.loop = true | |
src.connect(ctx.destination) | |
src.start(0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment