| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Biquad Tail Output</title> | 4 <title>Test Biquad Tail Output</title> |
| 5 <script src="../resources/js-test.js"></script> | 5 <script src="../resources/js-test.js"></script> |
| 6 <script src="resources/compatibility.js"></script> | 6 <script src="resources/compatibility.js"></script> |
| 7 <script src="resources/audio-testing.js"></script> | 7 <script src="resources/audio-testing.js"></script> |
| 8 </head> | 8 </head> |
| 9 | 9 |
| 10 <body> | 10 <body> |
| 11 <script> | 11 <script> |
| 12 description("Test Biquad Tail Output"); | 12 description("Test Biquad Tail Output"); |
| 13 window.jsTestIsAsync = true; | 13 window.jsTestIsAsync = true; |
| 14 | 14 |
| 15 // A high sample rate shows the issue more clearly. | 15 // A high sample rate shows the issue more clearly. |
| 16 var sampleRate = 192000; | 16 var sampleRate = 192000; |
| 17 // Some short duration because we don't need to run the test for very long
. | 17 // Some short duration because we don't need to run the test for very long
. |
| 18 var testDurationSec = 0.5; | 18 var testDurationSec = 0.5; |
| 19 var testDurationFrames = testDurationSec * sampleRate; | 19 var testDurationFrames = testDurationSec * sampleRate; |
| 20 | 20 |
| 21 // Amplitude experimentally determined to give a biquad output close to 1.
(No attempt was | 21 // Amplitude experimentally determined to give a biquad output close to 1.
(No attempt was |
| 22 // made to produce exactly 1; it's not needed.) | 22 // made to produce exactly 1; it's not needed.) |
| 23 var sourceAmplitude = 100; | 23 var sourceAmplitude = 100; |
| 24 | 24 |
| 25 // The output of the biquad filter should not change by more than this muc
h between output | 25 // The output of the biquad filter should not change by more than this muc
h between output |
| 26 // samples. Threshold was determined experimentally. | 26 // samples. Threshold was determined experimentally. |
| 27 var glitchThreshold = 0.0129; | 27 var glitchThreshold = 0.012968; |
| 28 | 28 |
| 29 // Test that a Biquad filter doesn't have it's output terminated because t
he input has gone | 29 // Test that a Biquad filter doesn't have it's output terminated because t
he input has gone |
| 30 // away. Generally, when a source node is finished, it disconnects itself
from any downstream | 30 // away. Generally, when a source node is finished, it disconnects itself
from any downstream |
| 31 // nodes. This is the correct behavior. Nodes that have no inputs (disco
nnected) are | 31 // nodes. This is the correct behavior. Nodes that have no inputs (disco
nnected) are |
| 32 // generally assumed to output zeroes. This is also desired behavior. Ho
wever, biquad | 32 // generally assumed to output zeroes. This is also desired behavior. Ho
wever, biquad |
| 33 // filters have memory so they should not suddenly output zeroes when the
input is | 33 // filters have memory so they should not suddenly output zeroes when the
input is |
| 34 // disconnected. This test checks to see if the output doesn't suddenly c
hange to zero. | 34 // disconnected. This test checks to see if the output doesn't suddenly c
hange to zero. |
| 35 function runTest() { | 35 function runTest() { |
| 36 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate)
; | 36 var context = new OfflineAudioContext(1, testDurationFrames, sampleRate)
; |
| 37 | 37 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 58 else | 58 else |
| 59 testFailed("Biquad tail output not correctly completed."); | 59 testFailed("Biquad tail output not correctly completed."); |
| 60 }).then(finishJSTest); | 60 }).then(finishJSTest); |
| 61 } | 61 } |
| 62 | 62 |
| 63 runTest(); | 63 runTest(); |
| 64 successfullyParsed = true; | 64 successfullyParsed = true; |
| 65 </script> | 65 </script> |
| 66 </body> | 66 </body> |
| 67 </html> | 67 </html> |
| OLD | NEW |