What is kabelsalat?
kabelsalat (= cable salad) is a live codable modular synthesizer for the browser. It lets you write synthesizer patches with an easy to use language based on JavaScript.
You don’t need coding skills to learn this!
Hello World
Here is a very simple example that generates a sine wave:
- Press to hear a beautiful sine tone.
- Change the number 200 to 400
- Hit ctrl+enter to update (or press )
- Hit ctrl+. to stop (or press )
Amplitude Modulation
Let’s modulate the amplitude using mul
:
Frequency Modulation
Let’s modulate the frequency instead:
Note: We could also have written sine(sine(4).range(210,230))
Subtractive Synthesis
A lonely sine wave is pretty thin, let’s add some oomph with a sawtooth wave and a low pass filter:
Impulses & Envelopes
We can apply a simple decay envelope with impulse
and perc
:
For more control over the shape, we can also use ADSR:
Note: impulse(1).perc(.5)
effectively creates a gate that lasts .5 seconds
Sequences
The seq
function allows us to cycle through different values using an
impulse:
Note: .saw()
will take everything on the left as input! More generally, x.y()
is the same as y(x)
!
Reusing nodes
In the above example, we might want to use the impulse to control the sequence and also an envelope:
Here we are creating the variable imp
to use the impulse in 2 places.
Another way to write the same is this:
The apply
method allows us to get a variable without breaking up our patch
into multiple blocks
slide
slide
acts as a so called “slew limiter”, making the incoming signal sluggish,
preventing harsh clicks. It can also be used for glissando effects:
Feedback Delay
Feedback is a core feature of kabelsalat. You can plug a node back to itself using a so called lambda function:
Multichannel Expansion
We can create multiple channels by using brackets:
In this case, we get 2 sine waves that will be used for the left and right channel of your sound system.
If we want more channels, we have to mix them down:
Look what happens when brackets are used in more than one place:
fold
fold
limits the signal in between [-1,1] by folding:
Distort
Modules
The graph representation of the previous patch is very much cable salad at this point. To improve things, you can define modules like this:
Note that in the graph above, the “synth” is a single node, hiding its internal complexity.
Defining modules is a more advanced feature and requires you to know how JS functions are written.