| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Custom Oscillator at Very Low Frequency</title> | 4 <title>Test Custom Oscillator at Very Low Frequency</title> |
| 5 <script src="../../resources/js-test.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> |
| 6 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 7 <script src="../resources/audio-testing.js"></script> | 8 <script src="../resources/audio-testing.js"></script> |
| 8 </head> | 9 </head> |
| 9 | 10 |
| 10 <body> | 11 <body> |
| 11 <script> | 12 <script> |
| 12 description("Test Custom Oscillator at Very Low Frequency"); | |
| 13 window.jsTestIsAsync = true; | |
| 14 | |
| 15 // Create a custom oscillator and verify that the parts of a periodic wave
that should be | 13 // Create a custom oscillator and verify that the parts of a periodic wave
that should be |
| 16 // ignored really are ignored. | 14 // ignored really are ignored. |
| 17 | 15 |
| 18 var sampleRate = 48000; | 16 var sampleRate = 48000; |
| 19 | 17 |
| 20 // The desired frequency of the oscillator. The value to be used depends
on the | 18 // The desired frequency of the oscillator. The value to be used depends
on the |
| 21 // implementation of the PeriodicWave and should be less than then lowest
fundamental | 19 // implementation of the PeriodicWave and should be less than then lowest
fundamental |
| 22 // frequency. The lowest frequency is the Nyquist frequency divided by the
max number of | 20 // frequency. The lowest frequency is the Nyquist frequency divided by the
max number of |
| 23 // coefficients used for the FFT. In the current implementation, the max n
umber of | 21 // coefficients used for the FFT. In the current implementation, the max n
umber of |
| 24 // coefficients is 2048 (for a sample rate of 48 kHz) so the lowest freque
ncy is 24000/2048 = | 22 // coefficients is 2048 (for a sample rate of 48 kHz) so the lowest freque
ncy is 24000/2048 = |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 i[0] = 1; // Sine term that doesn't actually exist in a Fourier series | 70 i[0] = 1; // Sine term that doesn't actually exist in a Fourier series |
| 73 i[1] = 0; | 71 i[1] = 0; |
| 74 var wave = context.createPeriodicWave(r, i); | 72 var wave = context.createPeriodicWave(r, i); |
| 75 | 73 |
| 76 osc.setPeriodicWave(wave); | 74 osc.setPeriodicWave(wave); |
| 77 osc.frequency.value = desiredFrequencyHz; | 75 osc.frequency.value = desiredFrequencyHz; |
| 78 osc.connect(context.destination); | 76 osc.connect(context.destination); |
| 79 osc.start(); | 77 osc.start(); |
| 80 context.startRendering().then(function (buffer) { | 78 context.startRendering().then(function (buffer) { |
| 81 checkCosineResult(buffer, desiredFrequencyHz, sampleRate); | 79 checkCosineResult(buffer, desiredFrequencyHz, sampleRate); |
| 82 }).then(finishJSTest); | 80 }); |
| 83 }; | 81 }; |
| 84 | 82 |
| 85 runTest(); | 83 runTest(); |
| 86 successfullyParsed = true; | |
| 87 </script> | 84 </script> |
| 88 </body> | 85 </body> |
| 89 </html> | 86 </html> |
| OLD | NEW |