SynthMachine

Open source browser synths. Web Audio API. No dependencies.

MIT License

SynthMachine is an early-stage open source project experimenting with music synthesis in the browser. Built on the Web Audio API, it's a collection of programmable instruments — drum machines, bass synths, and mono leads — that can be controlled via JavaScript. The goal is to explore what's possible when synthesis engines are accessible to code, whether that's a TypeScript app or an AI agent composing patterns. The demos here are proof-of-concept frontends showing the engines in action.

This is v0.1 territory. The synths work, but they're not circuit-accurate yet (and may never be — that's a hard problem). Consider this a code dump and learning resource. Use it, fork it, break it, learn from it. Contributions welcome.

R9-D9 drum machine

11 synthesized voices (kick, snare, clap, hats, toms, cymbals). Circuit-accurate E2 engine with waveshapers and bridged-T resonators. 16-step sequencer with swing and flam.

View source files
R9-DS sample drum machine

Sample-based drum machine with loadable kits. 10 slots, 6 parameters each (level, tune, attack, decay, filter, pan). Lowpass filter per voice. Amber Kit and 808 Kit included.

View source files
R3-D3 bass synth

Diode ladder filter emulation with self-oscillation. Sawtooth and square waves. 16-step sequencer with accent and slide. The squelch is real.

View source files
R1-D1 mono synth

VCO with saw/pulse, sub-oscillator, IR3109 filter, full ADSR, LFO with routing to pitch/filter/PWM. Arpeggiator and 16-step sequencer.

View source files
Mixer effects + session

Multi-track session with sidechain ducking, 4-band EQ, and convolution reverb. Combine all the synths into one mixed output. Render to WAV.

View source files
analyze-track CLI utility

WAV analysis tool. Reports peak/RMS levels, frequency balance across 4 bands, andsidechain detection. Generates spectrograms. Wraps sox — not browser-based.

npx ts-node tools/analyze-track.ts track.wav --spectrogram

Quick Start

// Import a synth
import { TR909Engine } from '/909/dist/machines/tr909/engine.js';
import { TB303Engine } from '/303/dist/machines/tb303/engine.js';
import { SH101Engine } from '/101/dist/machines/sh101/engine.js';

// Create and play
const drums = new TR909Engine();
drums.setBpm(128);
drums.startSequencer();

// Combine with mixer
import { Session } from '/mixer/dist/session.js';

const session = new Session({ bpm: 128 });
session.add('drums', drums);
session.add('bass', new TB303Engine({ context: session.context }));

// Sidechain the bass to the kick
session.channel('bass').duck({
  trigger: session.channel('drums').getVoiceOutput('kick'),
  amount: 0.6
});

// Render to WAV
const { wav } = await session.render({ bars: 8 });