Created
April 30, 2014 14:59
-
-
Save kishalmi/665fe7a8953a5b91cc3a to your computer and use it in GitHub Desktop.
reverse (copy of) webaudio buffer
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
request.onload = function () { | |
context.decodeAudioData(request.response, function (buf) { | |
// store as forward buffer | |
buffer = buf; | |
// create a reversed copy | |
bufferReversed = context.createBuffer(buf.numberOfChannels, buf.length, buf.sampleRate); | |
for (var i = 0; i < buf.numberOfChannels; i++) | |
bufferReversed.getChannelData(i).set( | |
Array.prototype.reverse.call(new Float32Array(buf.getChannelData(i))) | |
); | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment