gaycodegal/simple-zig-wasm-synthesizer
building a wasm web audio api synthesizer using zig
The intention of this project is to create a small (in code size) synthesizer to make bit tune sound effect / music for online games. This project is demonstrating compiling a polyphonic synthesizer in Zig and playing it from the web.
It is currently monophonic, but mostly usable.
Read the Write Up to learn how this was made.
Could I have used wave files for sfx and xm for music? Definitely, but I didn't want to, as I had already seen what Tic80 could do.
In its current state, it could be used to play short sound effects for online games. The code size is at last check ~19.2kb in js + wasm (without shortening variable names etc), or 8.5kb zipped. The audio it generates is 45kb/s 8bit audio.
The wasm binary itself is only 3kb.
This project is MIT licensed, the only outside code it uses is the NoteHz taken from Tic80 (which is also MIT Licensed). There is a license file for a file called wavefile.js but that code is not included in this github, and I only use it for testing to verify the waveforms are correct, but if you choose to download that file yourself, you have the license.