Get started
How to get started with Synthlet
Synthlet is a collection of audio modules implemented as AudioWorkletNodes that you can use to create synthesizers and audio effects in the browser.
Install
You can installl all modules using the synthlet
package:
Register worklet processors
Before you can create any module, you need to register the worklet processors. You can do this by calling the registerAllWorklets
to register all modules at once:
Register is async
registerAllWorklets
(and all register functions) are async, so ensure you
await for the result before creating any modules.
By convenience, registerAllWorklets
returns the AudioContext
so you can write it more concise:
Create the first synth
You can create a synth by creating nodes and connect them.
A simple archetipical monophonic synthesizer consist of an oscillator connected to a filter connected to an amplifier with an envelope.
Here's the full gist:
At this point you should able to hear some sound. If you don't hear anything, check the browser console for any errors.
No new required
Unlike the standard WebAudio API, Synthlet modules are functions, not classes.
So no new
is required to create a module.
No start required
Unlike the standard WebAudio API, Synthlet modules start automatically. No
need to call the start
method on the module to start it.
Read more about how to use the modules in the guide.