OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <title>Test Oscillator Node: triangle</title> |
| 5 <script src="resources/compatibility.js"></script> |
| 6 <script src="resources/buffer-loader.js"></script> |
| 7 <script src="../resources/js-test.js"></script> |
| 8 <script src="resources/oscillator-testing.js"></script> |
| 9 </head> |
| 10 |
| 11 <body> |
| 12 <script> |
| 13 // Scaling factor for converting the 16-bit WAV data to float (and vice-
versa). |
| 14 var waveScaleFactor = 32768; |
| 15 |
| 16 // Thresholds for verifying the test passes. The thresholds are experim
entally determined. |
| 17 |
| 18 // SNR must be greater than this to pass the test. |
| 19 // Q: Why is the SNR threshold not infinity? |
| 20 // A: The reference result is a 16-bit WAV file, so it won't compare exa
ctly with the |
| 21 // floating point result. |
| 22 var thresholdSNR = 84.85; |
| 23 |
| 24 // Max diff must be less than this to pass the test. |
| 25 var thresholdDiff = 2.50 / waveScaleFactor; |
| 26 |
| 27 // Count the number of differences between the expected and actual resul
t. The tests passes |
| 28 // if the count is less than this threshold. |
| 29 var thresholdDiffCount = 5100; |
| 30 |
| 31 function runTest () { |
| 32 window.jsTestIsAsync = true; |
| 33 |
| 34 // Create offline audio context. |
| 35 context = new OfflineAudioContext(1, sampleRate * lengthInSeconds, s
ampleRate); |
| 36 |
| 37 loadReferenceAndRunTest("triangle"); |
| 38 } |
| 39 |
| 40 runTest(); |
| 41 successfullyParsed = true; |
| 42 </script> |
| 43 </body> |
| 44 </html> |
OLD | NEW |