Collection of synth modules implemented as AudioWorklets.
import {
// Modules
Amp, // Amplifier with an envelope
Output, // Output with gain control
Polyblep, // Polyblep oscillator
Svf, // State Variable Filter
// Connections
Patch, // Create a patch
Serial, // Serial connection
// Utils
registerWorklets, // Register worklets
} from "synthlet";
// Initialize AudioContext
const ac = new AudioContext();
await registerWorklets(ac);
// Create modules
const osc = Polybleb.saw(ac, { frequency: 440 });
const filter = Svf.lp(ac, { frequency: 1000 });
const amp = Amp.adsr(ac, { trigger, attack: 0.01, release: 0.3 });
const out = Output(ac, { db: -3 });
// Make connections
Serial([osc, filter, amp, out]);
// Create a patch
const patch = Patch(out, { osc, filter, amp });
// Use the patch
patch.connect(ctx.destination);
patch.osc.frequency.value = 300;
patch.amp.gate.value = 1; // start sound
patch.amp.gate.value = 0; // stop sound
Install synthlet
to install all modules:
npm i synthlet
Or each module individually:
npm i @synthlet/adsr
Documentation and examples are here
Mostly, because I want to learn dsp.
Probably not, but I've seen a talk at WAC 2022 about it that made me think it is possible (thanks to JS engine optimizations).
Just for fun and curiosity. If you want to make music, Tone.js is probably the way to go.
If you want to deploy dsp modules to web in production, currently Faust and Cmajor or Elementary Audio are better alternatives.
This library wouldn't be possible with all the people writing books, blog posts and awesome libraries... and making music! Thanks to all 💚
- Designing Synth Plugins 2nd Edition
- Developing Virtual Synthesizers with VCV Rack
- BasicSynth: Creating a Music Synthesizer in Software
- Generating Sound and Organizing Time
- Designing Audio FX Plugins 2nd Edition
- https://github.com/BillyDM/awesome-audio-dsp
- https://paulbatchelor.github.io/sndkit/algos/
- https://www.musicdsp.org/
- Signalsmith Audio blog
- Valhalla DSP Blog
- http://synthworks.eu/ - DIY Synthetizers
- Karplus-Strong original paper
- Faust
- Cmajor
- VCVRack
- The Synthesis ToolKit
- Surge synth
- Surge Rust
- https://github.com/jd-13/WE-Core
- https://github.com/mhetrick/nonlinearcircuits
- https://github.com/timowest/analogue
- https://github.com/pichenettes/stmlib/tree/master/dsp
MIT License