| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 | 2 |
| 3 <!-- | 3 <!-- |
| 4 Tests that GainNode is properly scaling the gain. | 4 Tests that GainNode is properly scaling the gain. |
| 5 We'll render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1. | 5 We'll render 11 notes, starting at a gain of 1.0, decreasing in gain by 0.1. |
| 6 The 11th note will be of gain 0.0, so it should be silent (at the end in the ren
dered output). | 6 The 11th note will be of gain 0.0, so it should be silent (at the end in the ren
dered output). |
| 7 --> | 7 --> |
| 8 | 8 |
| 9 <html> | 9 <html> |
| 10 <head> | 10 <head> |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 } | 100 } |
| 101 | 101 |
| 102 context.startRendering() | 102 context.startRendering() |
| 103 .then(buffer => { | 103 .then(buffer => { |
| 104 let actual = buffer.getChannelData(0); | 104 let actual = buffer.getChannelData(0); |
| 105 should(actual, 'Output from gain node').beCloseToArray(reference, { | 105 should(actual, 'Output from gain node').beCloseToArray(reference, { |
| 106 absoluteThreshold: 3.0503e-5 | 106 absoluteThreshold: 3.0503e-5 |
| 107 }); | 107 }); |
| 108 let snr = 10 * Math.log10(computeSNR(actual, reference)); | 108 let snr = 10 * Math.log10(computeSNR(actual, reference)); |
| 109 should(snr, 'SNR (in dB)').beGreaterThanOrEqualTo(89.088); | 109 should(snr, 'SNR (in dB)').beGreaterThanOrEqualTo(89.088); |
| 110 let filename = 'gain-actual.wav'; |
| 111 if (downloadAudioBuffer(buffer, filename)) |
| 112 should(true, 'Saved reference file').message(filename, ""); |
| 110 }) | 113 }) |
| 111 .then(() => task.done()); | 114 .then(() => task.done()); |
| 112 ; | 115 ; |
| 113 }); | 116 }); |
| 114 | 117 |
| 115 audit.run(); | 118 audit.run(); |
| 116 </script> | 119 </script> |
| 117 | 120 |
| 118 </body> | 121 </body> |
| 119 </html> | 122 </html> |
| OLD | NEW |