Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Side by Side Diff: third_party/WebKit/LayoutTests/webaudio/convolution-mono-mono.html

Issue 2581463002: Refactor WebAudio test directory (Closed)
Patch Set: Use correct path for wav result files Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2
3 <html>
4 <head>
5 <script src="../resources/js-test.js"></script>
6 <script src="resources/compatibility.js"></script>
7 <script src="resources/audit-util.js"></script>
8 <script src="resources/audio-testing.js"></script>
9 <script src="resources/convolution-testing.js"></script>
10 </head>
11
12 <body>
13
14 <div id="description"></div>
15 <div id="console"></div>
16
17 <script>
18 description("Tests ConvolverNode processing a mono channel with mono impulse res ponse.");
19
20 // To test the convolver, we convolve two square pulses together to
21 // produce a triangular pulse. To verify the result is correct we
22 // check several parts of the result. First, we make sure the initial
23 // part of the result is zero (due to the latency in the convolver).
24 // Next, the triangular pulse should match the theoretical result to
25 // within some roundoff. After the triangular pulse, the result
26 // should be exactly zero, but round-off prevents that. We make sure
27 // the part after the pulse is sufficiently close to zero. Finally,
28 // the result should be exactly zero because the inputs are exactly
29 // zero.
30 function runTest() {
31 if (window.testRunner) {
32 testRunner.dumpAsText();
33 testRunner.waitUntilDone();
34 }
35
36 window.jsTestIsAsync = true;
37
38 // Create offline audio context.
39 var context = new OfflineAudioContext(2, sampleRate * renderLengthSeconds, s ampleRate);
40
41 var squarePulse = createSquarePulseBuffer(context, pulseLengthFrames);
42 var trianglePulse = createTrianglePulseBuffer(context, 2 * pulseLengthFrames );
43
44 var bufferSource = context.createBufferSource();
45 bufferSource.buffer = squarePulse;
46
47 var convolver = context.createConvolver();
48 convolver.normalize = false;
49 convolver.buffer = squarePulse;
50
51 bufferSource.connect(convolver);
52 convolver.connect(context.destination);
53
54 bufferSource.start(0);
55
56 context.oncomplete = checkConvolvedResult(trianglePulse);
57 context.startRendering();
58 }
59
60 runTest();
61 successfullyParsed = true;
62
63 </script>
64
65 </body>
66 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698