Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!doctype html> | |
| 2 <html> | |
| 3 <head> | |
| 4 <title>Test Cascade of Mono Convolvers</title> | |
| 5 <script src="../../resources/testharness.js"></script> | |
| 6 <script src="../../resources/testharnessreport.js"></script> | |
| 7 <script src="../resources/audit-util.js"></script> | |
| 8 <script src="../resources/audit.js"></script> | |
| 9 </head> | |
| 10 | |
| 11 <body> | |
| 12 <script> | |
| 13 let audit = Audit.createTaskRunner(); | |
| 14 | |
| 15 // Arbitrary sample rate and reasonably short duration | |
| 16 let sampleRate = 8000; | |
| 17 let duration = 0.25; | |
| 18 let renderFrames = duration * sampleRate; | |
| 19 | |
| 20 audit.define( | |
| 21 {label: 'test', description: 'Cascaded mono convolvers'}, | |
|
hongchan
2017/03/28 16:44:34
test => cascade-mono
| |
| 22 (task, should) => { | |
| 23 // Cascade two convolvers with mono responses and verify that the | |
| 24 // output is not silent. | |
| 25 let context = new OfflineAudioContext(1, renderFrames, sampleRate); | |
| 26 | |
| 27 let b0 = | |
| 28 new AudioBuffer({length: 5, sampleRate: context.sampleRate}); | |
| 29 b0.getChannelData(0)[1] = 1; | |
| 30 let c0 = new ConvolverNode( | |
| 31 context, {disableNormalization: true, buffer: b0}); | |
| 32 | |
| 33 let b1 = | |
| 34 new AudioBuffer({length: 5, sampleRate: context.sampleRate}); | |
| 35 b1.getChannelData(0)[2] = 1; | |
| 36 | |
| 37 let c1 = new ConvolverNode( | |
| 38 context, {disableNormalization: true, buffer: b1}); | |
| 39 | |
| 40 let src = new OscillatorNode(context); | |
| 41 | |
| 42 src.connect(c0).connect(c1).connect(context.destination); | |
| 43 | |
| 44 src.start(); | |
| 45 | |
| 46 context.startRendering() | |
| 47 .then(audioBuffer => { | |
| 48 // Just verify the output is not silent | |
| 49 let audio = audioBuffer.getChannelData(0); | |
| 50 | |
| 51 should(audio, 'Output of cascaded mono convolvers') | |
| 52 .notBeConstantValueOf(0); | |
| 53 }) | |
| 54 .then(() => task.done()); | |
| 55 }); | |
| 56 | |
| 57 audit.run(); | |
| 58 </script> | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |