How to export WAV files and ZIP archives entirely in the browser with vanilla JavaScript
I recently needed a small browser tool that could generate retro game sound effects and export several variations at once. The constraints were: no account or backend no audio upload no external ZIP library plain HTML/JavaScript that can be hosted on GitHub Pages output useful enough for a real game project The result is Retro SFX Lab , a free local browser SFX generator. Its newest version can…
The article discusses a browser-based tool called Retro SFX Lab that can generate retro game sound effects and export them as WAV files in a ZIP archive using only vanilla JavaScript. The tool is hosted on GitHub Pages and is available as open-source under the CC0 license.
The process of creating a WAV file involves generating audio data as a Float32Array and then carefully packing the binary data into the correct format. This includes handling the 44-byte header, converting floating-point samples to signed 16-bit PCM, and setting up the necessary chunk sizes. The wavBlob function handles all of these steps, ultimately returning a Blob object that can be used to create a downloadable link for the WAV file.
Creating a ZIP archive is simpler than it appears because it doesn't need to compress the entries. The tool uses the STORE method, which involves concatenating the WAV files without compression, followed by a central directory with small headers and CRC32 values for each file. The crc32 function provides a small, efficient implementation of the CRC32 checksum algorithm. Once the ZIP archive is created, it can be downloaded with a single line of code that sets up a download link with a temporary object URL.
Rewritten by urgent.news; may contain errors — check the original.
Source: dev.to