forked from corbanbrook/dsp.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
56b1001
commit 8c4ba49
Showing
3 changed files
with
52 additions
and
20 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
var bufferSize = 2048; | ||
var sampleRate = 44100; | ||
|
||
var buffer1 = new Float32Array(bufferSize); | ||
var buffer2 = new Float32Array(bufferSize); | ||
var buffer3 = new Float32Array(bufferSize); | ||
var buffer4 = new Float32Array(bufferSize); | ||
|
||
for (var i = 0; i < bufferSize; i++) { | ||
buffer1[i] = (i % 2 === 0) ? -Math.random() : Math.random(); | ||
} | ||
|
||
for (var i = 0; i < bufferSize; i++) { | ||
buffer2[i] = (i % 2 === 0) ? -Math.random() : Math.random(); | ||
} | ||
|
||
for (var i = 0; i < bufferSize; i++) { | ||
buffer3[i] = (i % 2 === 0) ? -Math.random() : Math.random(); | ||
} | ||
|
||
for (var i = 0; i < bufferSize; i++) { | ||
buffer4[i] = (i % 2 === 0) ? -Math.random() : Math.random(); | ||
} | ||
|
||
var channel; | ||
var temp; | ||
|
||
var duration = benchmark(function() { | ||
channel = DSP.deinterleave(DSP.MIX, buffer1); | ||
|
||
// cycle buffers | ||
temp = buffer1; | ||
buffer1 = buffer2; | ||
buffer2 = buffer3; | ||
buffer3 = buffer4; | ||
buffer4 = temp; | ||
}, 100000); | ||
|
||
print("Channel length: " + channel.length); | ||
print("100000 iterations: " + (duration) + " ms (" + ((duration) / 100000) + "ms per iter)\n"); |
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