| Index: LayoutTests/webaudio/osc-sawtooth-sweep-snr.html
|
| diff --git a/LayoutTests/webaudio/osc-sawtooth-sweep-snr.html b/LayoutTests/webaudio/osc-sawtooth-sweep-snr.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..32b29b5ced3aab99a0b5dc57917ea517f3a5fa30
|
| --- /dev/null
|
| +++ b/LayoutTests/webaudio/osc-sawtooth-sweep-snr.html
|
| @@ -0,0 +1,44 @@
|
| +<!doctype html>
|
| +<html>
|
| + <head>
|
| + <title>Test Oscillator Node: sawtooth</title>
|
| + <script src="resources/compatibility.js"></script>
|
| + <script src="resources/buffer-loader.js"></script>
|
| + <script src="../resources/js-test.js"></script>
|
| + <script src="resources/oscillator-testing.js"></script>
|
| + </head>
|
| +
|
| + <body>
|
| + <script>
|
| + // Scaling factor for converting the 16-bit WAV data to float (and vice-versa).
|
| + var waveScaleFactor = 32768;
|
| +
|
| + // Thresholds for verifying the test passes. The thresholds are experimentally determined.
|
| +
|
| + // SNR must be greater than this to pass the test.
|
| + // Q: Why is the SNR threshold not infinity?
|
| + // A: The reference result is a 16-bit WAV file, so it won't compare exactly with the
|
| + // floating point result.
|
| + var thresholdSNR = 83.00;
|
| +
|
| + // Max diff must be less than this to pass the test.
|
| + var thresholdDiff = 3.18 / waveScaleFactor;
|
| +
|
| + // Count the number of differences between the expected and actual result. The tests passes
|
| + // if the count is less than this threshold.
|
| + var thresholdDiffCount = 4100;
|
| +
|
| + function runTest () {
|
| + window.jsTestIsAsync = true;
|
| +
|
| + // Create offline audio context.
|
| + context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, sampleRate);
|
| +
|
| + loadReferenceAndRunTest("sawtooth");
|
| + }
|
| +
|
| + runTest();
|
| + successfullyParsed = true;
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|