Skip to content

Commit

Permalink
Update periodicWave.html to test with 8192 elements
Browse files Browse the repository at this point in the history
The Web Audio specification says the following:
"A conforming implementation MUST support PeriodicWave up to at least
8192 elements."

https://www.w3.org/TR/webaudio/#PeriodicWave

This CL increases the length of arrays used in the existing WPT from
4096 to 8192.

Note that it is ont clear what "support" means in this context:
WebAudio/web-audio-api#1415

A different test may be requried if "support" means that all
supplied coefficients up to 8192 must be used to generate the waveform.

Bug: 773502
Change-Id: I14d79616b94a65030c00ccba1245d9137e28a106
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4429796
Reviewed-by: Hongchan Choi <hongchan@chromium.org>
Commit-Queue: Michael Wilson <mjwilson@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1133502}
  • Loading branch information
Michael Wilson authored and chromium-wpt-export-bot committed Apr 21, 2023
1 parent e1beec6 commit 84da702
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions webaudio/the-audio-api/the-periodicwave-interface/periodicWave.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
const imagPeak = imag[3];
const imagFundamental = 551.0;

const testLength = 4096;
const testLength = 8192;
let context = new AudioContext();

let audit = Audit.createTaskRunner();
Expand All @@ -34,9 +34,9 @@

audit.define('create with factory method', (task, should) => {
should(() => {
context.createPeriodicWave(new Float32Array(4096), new Float32Array(4096));
}, 'context.createPeriodicWave(new Float32Array(4096), ' +
'new Float32Array(4096))').notThrow();
context.createPeriodicWave(new Float32Array(testLength), new Float32Array(testLength));
}, 'context.createPeriodicWave(new Float32Array(' + testLength + '), ' +
'new Float32Array(' + testLength + '))').notThrow();
task.done();
});

Expand All @@ -60,16 +60,16 @@

audit.define('create with constructor', (task, should) => {
should(() => {
new PeriodicWave(context, { real: new Float32Array(4096), imag: new Float32Array(4096) });
}, 'new PeriodicWave(context, { real : new Float32Array(4096), ' +
'imag : new Float32Array(4096) })').notThrow();
new PeriodicWave(context, { real: new Float32Array(testLength), imag: new Float32Array(testLength) });
}, 'new PeriodicWave(context, { real : new Float32Array(' + testLength + '), ' +
'imag : new Float32Array(' + testLength + ') })').notThrow();
task.done();
});

audit.define('different length with constructor', (task, should) => {
should(() => {
new PeriodicWave(context, { real: new Float32Array(4096), imag: new Float32Array(4) });
}, 'new PeriodicWave(context, { real : new Float32Array(4096), ' +
new PeriodicWave(context, { real: new Float32Array(testLength), imag: new Float32Array(4) });
}, 'new PeriodicWave(context, { real : new Float32Array(' + testLength + '), ' +
'imag : new Float32Array(4) })').throw(DOMException, "IndexSizeError");
task.done();
});
Expand All @@ -83,7 +83,7 @@
});

audit.define('output test', (task, should) => {
let context = new OfflineAudioContext(2, 4096, 44100);
let context = new OfflineAudioContext(2, testLength, 44100);
// Create the expected output buffer
let expectations = context.createBuffer(2, testLength, context.sampleRate);
for (var i = 0; i < expectations.length; ++i) {
Expand Down

0 comments on commit 84da702

Please sign in to comment.