Skip to main content
← Experiments

Synth

A browser synth you play from an Akai MPK Mini or your computer keyboard, with drum pads, loop tracks, and WAV export. Built on the Web Audio and Web MIDI APIs.

Open Synth ↗bgrrtt-synth.vercel.app
Screenshot of Synth

What I learned

  • Web MIDI is small. Reading a controller is about 40 lines. Mask the status byte to get the message type, treat a note-on with velocity zero as a note-off (controllers really send that), and combine the two pitch-bend bytes into a value from -1 to 1.
  • The MPK Mini's knobs map cleanly. Its eight knobs send CC 1 through 8 by default, so each knob drives one of the first eight parameters on the selected track: cutoff, resonance, envelope, attack, release, and so on.
  • WAV export needs no library. An OfflineAudioContext renders the loops faster than real time, and the WAV file is a 44-byte header plus 16-bit samples written by hand into a DataView. The catch in the first version: the export built its own copy of the mix chain, compressor settings and all, which has to stay in sync with live playback by hand.

How to help

  • Other controllers: if you have a MIDI keyboard or pad controller other than an MPK Mini, plug it in and email me what works: notes, velocity, pitch bend, knobs, pads.
  • Browsers: Web MIDI support varies by browser. Tell me which one you used and whether it found your device.
  • Sounds: send a loop you exported, or describe a patch or drum sound you wish it had.

Keep in touch

Questions, ideas, or something broke? Email me. For updates on this and whatever I build next, get the newsletter.