| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <title>Test Basic IIRFilterNode Operation</title> | 4 <title>Test Basic IIRFilterNode Operation</title> |
| 5 <script src="../../resources/testharness.js"></script> | 5 <script src="../../resources/testharness.js"></script> |
| 6 <script src="../../resources/testharnessreport.js"></script> | 6 <script src="../../resources/testharnessreport.js"></script> |
| 7 <script src="../resources/audit-util.js"></script> | 7 <script src="../resources/audit-util.js"></script> |
| 8 <script src="../resources/audit.js"></script> | 8 <script src="../resources/audit.js"></script> |
| 9 <script src="../resources/biquad-filters.js"></script> | 9 <script src="../resources/biquad-filters.js"></script> |
| 10 </head> | 10 </head> |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // input. | 163 // input. |
| 164 expected[0] = 1; | 164 expected[0] = 1; |
| 165 for (k = 1; k < testFrames; ++k) { | 165 for (k = 1; k < testFrames; ++k) { |
| 166 expected[k] = -c * expected[k-1]; | 166 expected[k] = -c * expected[k-1]; |
| 167 } | 167 } |
| 168 | 168 |
| 169 // Threshold isn't exactly zero due to round-off in the single-precisi
on IIRFilterNode | 169 // Threshold isn't exactly zero due to round-off in the single-precisi
on IIRFilterNode |
| 170 // computations versus the double-precision Javascript computations. | 170 // computations versus the double-precision Javascript computations. |
| 171 should(actual, 'IIR 1-pole output') | 171 should(actual, 'IIR 1-pole output') |
| 172 .beCloseToArray(expected, { | 172 .beCloseToArray(expected, { |
| 173 relativeThreshold: 5.723e-8 | 173 absoluteThreshold: 2.7657e-8 |
| 174 }); | 174 }); |
| 175 }).then(() => task.done()); | 175 }).then(() => task.done()); |
| 176 }); | 176 }); |
| 177 | 177 |
| 178 // Return a function suitable for use as a defineTask function. This func
tion creates an | 178 // Return a function suitable for use as a defineTask function. This func
tion creates an |
| 179 // IIRFilterNode equivalent to the specified BiquadFilterNode and compares
the outputs. The | 179 // IIRFilterNode equivalent to the specified BiquadFilterNode and compares
the outputs. The |
| 180 // outputs from the two filters should be virtually identical. | 180 // outputs from the two filters should be virtually identical. |
| 181 function testWithBiquadFilter (filterType, errorThreshold, snrThreshold) { | 181 function testWithBiquadFilter (filterType, errorThreshold, snrThreshold) { |
| 182 return (task, should) => { | 182 return (task, should) => { |
| 183 var context = new OfflineAudioContext(2, testFrames, sampleRate); | 183 var context = new OfflineAudioContext(2, testFrames, sampleRate); |
| (...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 552 var snr = 10*Math.log10(computeSNR(actual, expected)); | 552 var snr = 10*Math.log10(computeSNR(actual, expected)); |
| 553 should(snr, "SNR of 4-th order IIRFilter (biquad ref)") | 553 should(snr, "SNR of 4-th order IIRFilter (biquad ref)") |
| 554 .beGreaterThanOrEqualTo(108.947); | 554 .beGreaterThanOrEqualTo(108.947); |
| 555 }).then(() => task.done()); | 555 }).then(() => task.done()); |
| 556 }); | 556 }); |
| 557 | 557 |
| 558 audit.run(); | 558 audit.run(); |
| 559 </script> | 559 </script> |
| 560 </body> | 560 </body> |
| 561 </html> | 561 </html> |
| OLD | NEW |