annotate fft/test.html @ 8:c6577c4b3780

KissFFT example -- but am having trouble with calling conventions when both Emscripten examples are present
author Chris Cannam
date Mon, 05 Oct 2015 13:58:09 +0100
parents 47f08ebded06
children ae456984c912
rev   line source
Chris@3 1 <html>
Chris@7 2 <head>
Chris@7 3
Chris@3 4 <meta charset="UTF-8">
Chris@1 5
Chris@3 6 <style type="text/css">
Chris@3 7 body { margin: 5%; }
Chris@3 8 table, td, th { border: 0.1em solid #e0e0e0; border-collapse: collapse }
Chris@3 9 td, th { padding: 0.5em }
Chris@3 10 </style>
Chris@3 11
Chris@3 12 <script src="nayuki/fft.js"></script>
Chris@3 13 <script src="fft.js/lib/complex.js"></script>
Chris@3 14 <script src="jsfft/lib/complex_array.js"></script>
Chris@3 15 <script src="jsfft/lib/fft.js"></script>
Chris@7 16 <script src="cross/Cross.js"></script>
Chris@7 17 <script src="cross/FFT.js"></script>
Chris@8 18 <script src="kissfft/KissFFT.js"></script>
Chris@8 19 <script src="kissfft/FFT.js"></script>
Chris@3 20 <script src="test.js"></script>
Chris@1 21
Chris@7 22 </head>
Chris@3 23 <body>
Chris@2 24
Chris@3 25 <h3>Results</h3>
Chris@1 26
Chris@3 27 <p id="test-description"></p>
Chris@3 28
Chris@3 29 <table>
Chris@3 30 <tr>
Chris@3 31 <th>Implementation</th><th>Result</th><th>Time (first half)</th><th>Time (second half)</th><th>Rate (second half)</th>
Chris@3 32 </tr>
Chris@3 33 <tr>
Chris@3 34 <td>Nayuki</td><td id="nayuki-result"></td><td id="nayuki-1"></td><td id="nayuki-2"></td><td id="nayuki-itr"></td>
Chris@3 35 </tr><tr>
Chris@3 36 <td>Nockert</td><td id="nockert-result"></td><td id="nockert-1"></td><td id="nockert-2"></td><td id="nockert-itr"></td>
Chris@3 37 </tr><tr>
Chris@3 38 <td>Dntj</td><td id="dntj-result"></td><td id="dntj-1"></td><td id="dntj-2"></td><td id="dntj-itr"></td>
Chris@7 39 </tr><tr>
Chris@7 40 <td>Cross</td><td id="cross-result"></td><td id="cross-1"></td><td id="cross-2"></td><td id="cross-itr"></td>
Chris@8 41 </tr><tr>
Chris@8 42 <td>KissFFT</td><td id="kissfft-result"></td><td id="kissfft-1"></td><td id="kissfft-2"></td><td id="kissfft-itr"></td>
Chris@3 43 </tr>
Chris@3 44 </table>
Chris@1 45
Chris@3 46 <h3>Notes</h3>
Chris@1 47
Chris@3 48 <ul>
Chris@3 49 <li><b>Nayuki</b>: in-place single-precision complex-complex</li>
Chris@3 50 <li><b>Nockert</b>: double-precision real-complex</li>
Chris@4 51 <li><b>Nayuki</b>: double-precision complex-complex. Forward transform is scaled and I've scaled it back again here, which may introduce rounding error.</li>
Chris@7 52 <li><b>Cross</b>: double-precision real-complex in C, compiled with Emscripten. This is considered a slow implementation amongst native code ones.</li>
Chris@8 53 <li><b>KissFFT</b>: single-precision real-complex in C, compiled with Emscripten. This should be a faster implementation than Cross.</li>
Chris@3 54 </ul>
Chris@3 55
Chris@3 56 <h3>Rationale</h3>
Chris@1 57
Chris@3 58 <p>If 2150 iterations of real-to-complex FFT of size 2048 takes less
Chris@3 59 than 10 seconds, then we may be able to make a high quality
Chris@3 60 real-time phase vocoder (just).</p>
Chris@1 61
Chris@3 62 <p>A phase-vocoder of course must use overlapped windowed FFT
Chris@3 63 (although you can choose the size, within limits), IFFT, and
Chris@3 64 cartesian-polar conversion to calculate the phase for the
Chris@3 65 instantaneous frequency.</p>
Chris@1 66
Chris@3 67 <p>A reasonable estimate of CPU cost for the whole thing is
Chris@3 68 somewhere around 10x the cost of simple non-overlapping short-time
Chris@3 69 forward Fourier transforms across the signal. </p>
Chris@1 70
Chris@3 71 <p>2150 iterations corresponds to 100 seconds of audio
Chris@3 72 non-overlapped at 44.1kHz, so if that takes less than 10 seconds,
Chris@3 73 then in theory we might be OK.</p>
Chris@1 74
Chris@3 75 </body>
Chris@1 76