sound-synthesis

another machine GitHub ↗

AudioGraph, FMVoice, DrumMachine

An AudioGraph owns the bus topology; voices connect into its named buses and everything downstream is already wired. Here eight FMVoice objects arpeggiate into the pluck bus while a DrumMachine schedules percussion into the layer sum.

new AudioGraph({ audioContext: AudioContext }) · new FMVoice({ audioContext, destination, ratio?, index? }) · new DrumMachine({ drumSynth, bpm?, pattern? })

const graph = new AudioGraph({ audioContext });
graph.bypassInsert();

const voice = new FMVoice({
  audioContext,
  destination: graph.pluckBus,
  ratio: ,
  index: 
});
voice.pluck(220, { ampDecayTau:  });

const drums = new DrumMachine({
  drumSynth,
  bpm: ,
  pattern: ""
});
drums.start();

Status

stopped

Limiter

The graph runs a DynamicsCompressor from the start and swaps in the lookahead limiter only once its worklet has actually loaded. A worklet that fails to load costs the sound nothing.

Voices are pooled

FMVoice starts its oscillators once and keeps them running. The arpeggio re-plucks eight voices in rotation rather than building an oscillator pair per note — the 3 ms retrigger crossfade in pluck only works on a carrier that is already going.