synthlet
v0.10.0
Published
Modular synthesis in the browser
Downloads
40
Maintainers
Readme
Synthlet
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
Install synthlet
to install all modules:
npm i synthlet
Or each module individually:
npm i @synthlet/adsr
Documentation
Documentation and examples are here
Why?
Mostly, because I want to learn dsp.
Is it a good idea to write dsp in Typescript?
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).
Should I use it?
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.
References
This library wouldn't be possible with all the people writing books, blog posts and awesome libraries... and making music! Thanks to all 💚
Books
- 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
Posts and papers
- 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
Synthesis open source repositories
- 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
Other
License
MIT License