- Notifications
You must be signed in to change notification settings - Fork0
braheezy/wavvy
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A toy WAV audio player,WASM-style for the browser. You can play a WAV file. You might even be able to play a second one!
I wrote this to learn WASM with Go and specifically audio playback withoto
because I wanted to get ready for porting mygoqoa
project to WASM.
The Go code shown on the site is compiled to a WASM binary and delivered to the browser when you visit. It contains all the logic to read, decode, and perform audio playback of a WAV file. All right in the browser, no weirdo server to talk to. I think this means as long as the file stays cached in the browser, the website will continue to work even if your device is offline.
The HTML frontend provides basic controls to select a WAV file and give it to the WASM executable via explicitly exposed functions. For funs, it also reads the local Go code frommain.go and useshighlight.js to give it some life.
Other than a few more CDN pulls for fonts, this single-page application is comprised of a singleindex.html
file along with the requisitewasm_exec.js
file that provides the Go glue. And of course, the compiledmain.wasm
.
To work with this project locally, you need Go and a way to run a web server. Here's the commands I ran:
# Build itGOOS=js GOARCH=wasm go build -o main.wasm main.go# Serve itpython -m http.server
About
🎵 WAV player in Go WASM 🎵