# LAME 3.100, compiled to WebAssembly: the MP3 encoder behind `/mp4-to-mp3`

`/mp4-to-mp3` decodes a video's sound in the browser and encodes it as MP3 with LAME. LAME runs as
a WebAssembly file of its own, fetched by the page's worker the first time a file is converted and
never on a page load. It is not bundled into the site's JavaScript and it is not modified.

| | |
|---|---|
| Library | [LAME](https://lame.sourceforge.io/) 3.100, the MP3 encoder |
| Licence | GNU Library General Public License, version 2 (`COPYING`, beside this file; LAME's sources allow version 2 or any later version) |
| Built by | the npm package [`wasm-media-encoders`](https://github.com/arseneyr/wasm-media-encoders) 0.7.0, pinned in `package.json`, file `wasm/mp3.wasm`. Its build scripts and the small C bridge it links with LAME are in that repository (MIT) |
| LAME source | https://sourceforge.net/projects/lame/files/lame/3.100/ |
| Size | 132,999 bytes |
| SHA-256 | `85e81719250b9a667b1258143f689dda70e3e57a7e7c29ab0b4cef65c8f6eb9a` |
| Served at | `/static/vendor/mp3/lame-3.100/mp3.wasm`, with `COPYING.txt`, `NOTICE.md` and the wrapper's `LICENSE-wasm-media-encoders.txt` beside it |

`build/build.mjs` copies the file from `node_modules` to `web/static/vendor/` and checks the hash
above (`src/media/mp3-assets.ts`), so a changed or swapped copy fails the build rather than a
visitor's conversion.

**Replacing it.** The encoder is a separate file loaded at run time through a fixed interface (the
`wasm-media-encoders` 0.7.0 JavaScript, bundled into `/static/build/audio/audio-out-worker.js`). Any
build of LAME made with that repository's scripts at the same version can stand in for it, served at
the same path or substituted in the browser.
