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

Unified Diff: third_party/WebKit/LayoutTests/webaudio/PeriodicWave/periodicwave-lengths.html

Issue 2807673002: createPeriodicWave parameters are sequence<float> (Closed)
Patch Set: Rebaseline test Created 3 years, 8 months 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/webaudio/PeriodicWave/periodicwave-lengths.html
diff --git a/third_party/WebKit/LayoutTests/webaudio/PeriodicWave/periodicwave-lengths.html b/third_party/WebKit/LayoutTests/webaudio/PeriodicWave/periodicwave-lengths.html
index e097a1ffea29e0c40acc8cf1b54e8e5ea8ceb3f5..c200df08146cf7e67b7eaef94c7039d6e01a9a16 100644
--- a/third_party/WebKit/LayoutTests/webaudio/PeriodicWave/periodicwave-lengths.html
+++ b/third_party/WebKit/LayoutTests/webaudio/PeriodicWave/periodicwave-lengths.html
@@ -47,15 +47,12 @@
verifier: resultShouldBeNonZero
},
- // Test that we use all 8192 Fourier coefficients at 192 kHz sample rate. Ideally, we'd
- // like to compare 8191 coefficients vs 8192 coefficients. However, due to single-precision
- // arithmetic, the wave forms are identical in this case. Thus, use a somewhat smaller
- // value where the wave forms are actually different.
+ // Test that we use all 8192 Fourier coefficients at 192 kHz sample rate.
{
name: "192khz-test-3",
sampleRate: 192000,
bigWave: 8192,
- smallWave: (8 - 1 / 256) * 1024,
+ smallWave: 8191,
verifier: resultShouldBeNonZero
},
@@ -185,9 +182,12 @@
var bigWaveRealCoef = new Float32Array(bigPeriodicWaveLength);
var bigWaveImagCoef = new Float32Array(bigPeriodicWaveLength);
- // Set up the Fourier coefficients for a square wave.
- for (var k = 0; k < bigPeriodicWaveLength; k += 2) {
- bigWaveImagCoef[k] = 4 / Math.PI / k;
+ // Set up the Fourier coefficients for a sawtooth wave. We use
+ // sawtooth because all coefficients are non-zero
+ bigWaveImagCoef[0] = 0;
+ for (var k = 1; k < bigPeriodicWaveLength; k++) {
+ var piFactor = 2 / (Math.PI * k);
+ bigWaveImagCoef[k] = piFactor * ((k % 2 === 0) ? -1 : 1);
if (k < smallPeriodicWaveLength)
smallWaveImagCoef[k] = bigWaveImagCoef[k];
}

Powered by Google App Engine
This is Rietveld 408576698