| OLD | NEW |
| 1 // Notes about generated waveforms: | 1 // Notes about generated waveforms: |
| 2 // | 2 // |
| 3 // QUESTION: Why does the wave shape not look like the exact shape (sharp edges)
? | 3 // QUESTION: Why does the wave shape not look like the exact shape (sharp edges)
? |
| 4 // ANSWER: Because a shape with sharp edges has infinitely high frequency conten
t. | 4 // ANSWER: Because a shape with sharp edges has infinitely high frequency conten
t. |
| 5 // Since a digital audio signal must be band-limited based on the nyquist freque
ncy (half the sample-rate) | 5 // Since a digital audio signal must be band-limited based on the nyquist freque
ncy (half the sample-rate) |
| 6 // in order to avoid aliasing, this creates more rounded edges and "ringing" in
the | 6 // in order to avoid aliasing, this creates more rounded edges and "ringing" in
the |
| 7 // appearance of the waveform. See Nyquist-Shannon sampling theorem: | 7 // appearance of the waveform. See Nyquist-Shannon sampling theorem: |
| 8 // http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem | 8 // http://en.wikipedia.org/wiki/Nyquist%E2%80%93Shannon_sampling_theorem |
| 9 // | 9 // |
| 10 // QUESTION: Why does the very end of the generated signal appear to get slightl
y weaker? | 10 // QUESTION: Why does the very end of the generated signal appear to get slightl
y weaker? |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 { | 105 { |
| 106 if (nPower == 0 && sPower > 0) { | 106 if (nPower == 0 && sPower > 0) { |
| 107 return 1000; | 107 return 1000; |
| 108 } | 108 } |
| 109 return 10 * Math.log10(sPower / nPower); | 109 return 10 * Math.log10(sPower / nPower); |
| 110 } | 110 } |
| 111 | 111 |
| 112 function loadReferenceAndRunTest(oscType) { | 112 function loadReferenceAndRunTest(oscType) { |
| 113 var bufferLoader = new BufferLoader( | 113 var bufferLoader = new BufferLoader( |
| 114 context, | 114 context, |
| 115 [ "oscillator-" + oscType + "-expected.wav" ], | 115 [ "../Oscillator/oscillator-" + oscType + "-expected.wav" ], |
| 116 function (bufferList) { | 116 function (bufferList) { |
| 117 reference = bufferList[0].getChannelData(0); | 117 reference = bufferList[0].getChannelData(0); |
| 118 generateExponentialOscillatorSweep(context, oscType); | 118 generateExponentialOscillatorSweep(context, oscType); |
| 119 context.oncomplete = checkResult; | 119 context.oncomplete = checkResult; |
| 120 context.startRendering(); | 120 context.startRendering(); |
| 121 }); | 121 }); |
| 122 | 122 |
| 123 bufferLoader.load(); | 123 bufferLoader.load(); |
| 124 } | 124 } |
| 125 | 125 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 thresholdDiff: thresholdDiff, | 206 thresholdDiff: thresholdDiff, |
| 207 thresholdDiffCount: thresholdDiffCount, | 207 thresholdDiffCount: thresholdDiffCount, |
| 208 waveScaleFactor: waveScaleFactor, | 208 waveScaleFactor: waveScaleFactor, |
| 209 setThresholds: setThresholds, | 209 setThresholds: setThresholds, |
| 210 loadReferenceAndRunTest: loadReferenceAndRunTest, | 210 loadReferenceAndRunTest: loadReferenceAndRunTest, |
| 211 runTest: runTest, | 211 runTest: runTest, |
| 212 createNewReference: createNewReference, | 212 createNewReference: createNewReference, |
| 213 }; | 213 }; |
| 214 | 214 |
| 215 }()); | 215 }()); |
| OLD | NEW |