Synthlet

Synths

Available built-in synthesizers

Some synthesizers are provided for convenience. They are implemented by connecting different modules together.

Mono synthesizer

A monophonic synthesizer with a single PolyBLEP oscillator and an ADSR envelope on the filter and amplifier.

import { registerAllWorklets, MonoSynth } from "synthlet";
 
const ac = registerAllWorklets(new AudioContext());
const synth = MonoSynth(ac);
 
synth.gate.value = 1;
 
// It exposes several sub-modules
synth.vibrato.frequency.value = 0.5;
synth.filterEnv.attack.value = 0.1;

Parameters

  • gate: 0 or 1, triggers the envelope
  • frequency: in Hz
  • volume: in decibels. Default is 0.

Modules

  • vibrato: LFO for pitch modulation
  • filterEnv: ADSR envelope the filter

Drums

Several drum synthesizers are available, all with the same constructor: Drum(audioContext, inputs):

import { registerAllWorklets, KickDrum } from "synthlet";
 
const ac = registerAllWorklets(new AudioContext());
const kick = KickDrum(ac, { tone: 0.2, decay: 0.7 });
kick.trigger.value = 1;
kick.tone.value = 0.5;

Parameters

All drum modules share the same parameters:

  • trigger: 0 or 1, triggers the drum sound
  • tone: 0 to 1, changes the timbre of the drum (scale depends on the drum)
  • decay: 0 to 1, changes the length of the drum sound (sale depends on the drum)
  • volume: in decibels. Default is 0.

Available drums

The following drums are available:

  • KickDrum
  • SnareDrum
  • ClaveDrum
  • HiHatDrum
  • CowBellDrum
  • CymbalDrum
  • MaracasDrum
  • HandclapDrum
  • TomDrum
  • CongaDrum

On this page