# Optional FFT source and rebuild

The application uses an adapted copy of SoundTouchJS 2.1.1's phase vocoder.
The original spectral processing is retained. Its FFT calls can use the local
WebAssembly translation, with the original JavaScript FFT as a fallback.

The modified files are available under MPL-2.0:

- `phase-vocoder.mjs`: pinned class with local FFT and original window imports.
- `fft.mjs`: optional backend initialization, copying and JavaScript fallback.
- `fft.wat`: readable FFT source. Working-array stores round to Float32;
  arithmetic and twiddle recursion retain the JavaScript Float64 order.
- `fft-binary.mjs`: compiled bytes used by the application.
- `build-fft.mjs`: source-to-binary build script.

Original copyright: Steve "Cutter" Blades and SoundTouchJS contributors.
The local adaptation retains the MPL notice. The included SoundTouchJS source
archive contains the original tagged source and published modules.

To rebuild the downloaded FFT source in a separate directory with Node 22.22+:

```sh
npm install --ignore-scripts --save-exact wabt@1.0.39
node build-fft.mjs fft.wat fft-binary.mjs
```

For the complete application source tree, run `npm ci`, `npm run build:fft`,
`npm test`, `npm run test:wasm`, and `npm run build`. WABT is a development
compiler and is not shipped to the browser. Its package is Apache-2.0; compiling
this source does not include the compiler in the generated 824-byte module.

The worker installs its message handler before awaiting optional initialization.
Unavailable or rejected WebAssembly compilation keeps the JavaScript path.
The application permits replacing the compatible FFT or library source and
rebuilding; no restriction on modification or debugging is imposed.
