Collection of synth modules implemented as AudioWorklets.
import {
registerAllWorklets,
AdsrAmp,
Svf,
SvfType,
PolyblepOscillator
} from "synthlet";
const ac = new AudioContext();
await registerAllWorklets(ac);
// Simplest synth: Oscillator -> Filter -> Amplifier
const osc = PolyblepOscillator(ac, { frequency: 440 });
const filter = Svf(ac, {
type: SvfType.LowPass
frequency: 4000,
});
const amp = AdsrAmp(ac, { attack: 0.1, release: 0.5 });
osc.connect(filter).connect(amp).connect(ac.destination);
// Change parameters
osc.frequency.value = 1200;
// Start sound
amp.gate.value = 1;
// Stop sound
vca.gate.value = 0;
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
- 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