blob: ad37f0f6aaced9cd4ef75db461bfdc7d0156c62f [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<title>
Test Oscillator Node: sawtooth
</title>
<script src="../../imported/w3c/web-platform-tests/resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../resources/audit-util.js"></script>
<script src="../resources/audit.js"></script>
<script src="../resources/buffer-loader.js"></script>
<script src="../resources/oscillator-testing.js"></script>
<script src="../resources/audio-file-utils.js"></script>
</head>
<body>
<script id="layout-test-code">
let audit = Audit.createTaskRunner();
// Create an offline context with a sample rate that is very different
// from the sample rate used in the OscillatorTestingUtils. This will
// create a internal PeriodicWave objects for the Oscillator. This should
// not interfere with the oscillator test using a different context with a
// different sample rate.
audit.define('test', (task, should) => {
let context0 = new OfflineAudioContext(1, 1, 3000);
let osc = context0.createOscillator();
osc.type = 'sawtooth';
osc = null;
// This test is identical to the test in osc-sawtooth-sweep-snr.html.
let tester = OscillatorTestingUtils;
let context = new OfflineAudioContext(
1, tester.sampleRate * tester.lengthInSeconds, tester.sampleRate);
// The thresholds are experimentally determined.
tester.setThresholds({snr: 80.00, maxDiff: 4.06});
tester.runTest(
context, 'sawtooth', 'Sawtooth PeriodicWave Test', task, should);
});
audit.run();
</script>
</body>
</html>