GoJam: Pure-Go Guitar DSP Compiled to WebAssembly with a 3D Three.js Studio
In Plain English: Most browser music tools are basic tuners that only guess a single note, while real practice games require heavy desktop installs. So I built GoJam — my own pure-Go audio engine (
gojam) compiled straight to WebAssembly — letting you plug a guitar cable (or sing into your laptop mic) inside a browser tab for live pitch tracking, chord coaching, calibration, and a 3D note highway, with zero audio ever leaving your device.TL;DR:
gojamis a standard-library-only Go audio library for overtone-safe pitch detection, chord verification, musical note events, and presets across guitar, bass, ukulele, and voice. Compiling that exact same Go core to WebAssembly (GOOS=js GOARCH=wasm) produces a2.8 MB.wasmmodule running smoothly inside a browser Web Worker alongside an interactive studio you can try live at gojam.dev.
I recently rediscovered my guitars and wanted to get back into playing. Having spent hours with games like Rocksmith in the past, I caught myself wondering: could I actually build something like that myself — without a massive C++ engine, and running right inside a browser tab?
Every time I looked at existing audio stacks, they split into two extremes:
- Native desktop/game stacks (C++, JUCE, custom audio engines) where cross-compiling between a laptop, an old Linux tablet sitting on my music stand, and a web demo turns into build-system maintenance.
- Toy browser tuners built on a quick loop in JavaScript that guess a note name, jump octaves on overtones, and have no concept of note timing or chords.
After digging my earlier September prototypes back up via VibeCockpit, I decided to build one small audio engine in plain Go with zero external dependencies and see how far it could go. That engine is gojam, and its live browser studio is GoJam.dev.
One Pure-Go DSP Core, Three Targets
The core packages in gojam (pitch, detect, chord, performance, pcm) depend only on the Go standard library. Even though my real-instrument validation is guitar-first, the DSP core itself is instrument-agnostic — with presets for Guitar, Bass, Ukulele, and Voice, plus pluggable chord dictionaries.
That single stdlib-only constraint pays off immediately: the exact same DSP code compiles cleanly to native x86-64, pure-Go ARMv7 (for that music-stand tablet), and GOOS=js GOARCH=wasm in the browser.
What Actually Makes a Guitar Engine Useful
Detecting a frequency from a clean sine wave takes 30 lines of code. Real guitars are messier: string harmonics can outweigh the fundamental note, quiet sustains fade below noise floors, and browsers aggressively mangle instrument input unless you turn off voice filters first:
const stream = await navigator.mediaDevices.getUserMedia({
audio: {
deviceId: { exact: selectedDeviceId },
echoCancellation: false,
noiseSuppression: false,
autoGainControl: false,
},
});
Inside gojam, four practical design choices bridge the gap between a sine-wave toy and a playable studio:
- Overtone-safe pitch tracking (YIN): Plucked strings often have harmonics louder than the fundamental note itself. Instead of naively grabbing the loudest peak and jumping octaves, YIN tracks the true repeating period of the string or voice.
- Audio-sample timing instead of wall clocks: Every note onset, sustain, bend, and release is stamped against the audio stream’s sample counter rather than JavaScript timers, keeping rhythm judgement consistent even if UI frames dip.
- Explicit pickup calibration instead of hidden auto-gain: A quick calibration pass listens to muted-string hum and a few clean plucks to set honest silence and trust thresholds — without riding gain behind your back.
- Chord verification over blind guessing: Rather than claiming magic polyphonic transcription from a single mono cable,
gojamprobes the expected notes of a target chord and reports which tones rang clearly and which ones were muted or weak.
Keeping the hot paths allocation-free in Go also meant the compiled WebAssembly worker runs well ahead of real-time in the browser without garbage-collector hiccups.
What Changed the Moment I Plugged In an Actual Guitar
Synthetic test signals said everything was ready. Then I plugged an electric guitar in via a Rocksmith USB cable, sat three feet back from my laptop with a guitar in my hands, and immediately ran into four things no unit test catches:
- You can’t squint at tiny sideways tabs while holding a guitar: Side-scrolling fret numbers were unreadable at playing distance. That drove Fullscreen mode (
F) and switching Jam Mode to a towards-the-player 3D perspective highway with color-coded string lanes and high-contrast fret badges. - Passive guitar pickups look “dead” on normal Web Audio meters: Unamplified guitar signals sit much quieter than speech, so the spectrum bars initially looked invisible until I tuned the meter range specifically for raw pickups.
- USB capture + browser audio adds real latency: Even fast DSP feels slightly late unless visual judgement matches your ears — so I added a guided 3-step Setup Wizard with noise-floor calibration, a 4-pluck flash/click Latency Sync, and a 6-string tuner.

- Full-speed riffs are brutal on a first playthrough: Adding live
0.5×–1.15×speed scaling (while keeping hit-timing windows fair) plus a 3D Chord Coach turned it from a tech demo into something genuinely fun to practice with.

Bonus: If It Tracks Pitch, Can It Do Vocals Too?
Once I added multi-instrument presets (Guitar, Bass, Ukulele, and Voice) to gojam, an obvious December idea popped up: not everyone reading this has a guitar and USB cable sitting next to their laptop — everyone has a microphone.
So alongside the 3D guitar modes on gojam.dev, I wired up a Vocal Stage running on the exact same gojam WebAssembly binary (switched to its vocal preset with octave-agnostic pitch matching) loaded with a few public-domain Christmas classics like Jingle Bells and Silent Night.
Try It Live
You can try both the 3D Guitar Studio and the Vocal Stage right in your browser at gojam.dev — no install, no account, and zero audio leaving your device. For now it’s still an early-access passion project while I keep testing across more guitars, pickups, and microphones and see where to take it next.
The views and opinions expressed here are my own and do not reflect those of my employer.