Skip to content

Instantly share code, notes, and snippets.

@padenot
Created January 21, 2015 13:52
Show Gist options
  • Save padenot/64d001ee1e396794331c to your computer and use it in GitHub Desktop.
Save padenot/64d001ee1e396794331c to your computer and use it in GitHub Desktop.
if (window.SIMD) {
// yay, SIMD available, let's do a little stereo mixdown routine
for (var i = 0; i < bufsize; i+=4) {
var lhs = SIMD.float32x4(left[i+0], left[i+1],
left[i+2], left[i+3]),
rhs = SIMD.float32x4(right[i+0], right[i+1],
right[i+2], right[i+3]),
mixdown = SIMD.float32x4();
mixdown = lhs.add(rhs);
SIMD.float32x4.store(center, i, mixdown)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment