Using CSound with Strudel

πŸ§ͺ Strudel has experimental support for csound, using @csound/browser.

Importing .orc files

To use existing csound instruments, you can load and use an orc file from an URL like this:

Note that the above url uses the github: shortcut, which resolves to the raw file on github, but you can use any URL you like.

The awesome livecode.orc by Steven Yi comes packed with many sounds ready for use:

Writing your own instruments

You can define your own instrument(s) with loadCsound like this:

Parameters

The .csound function sends the following p values:

p1instrument name e.g. CoolSynth
p2time offset, when it should play
p3the duration of the event / hap
p4frequency in Hertz
p5normalized gain, 0-1

There is an alternative .csoundm function with a different flavor:

p4midi key number, unrounded, 0-127
p5midi velocity, 0-127

In both cases, p4 is derived from the value of freq or note.

Limitations / Future Plans

Apart from the above listed p values, no other parameter can be patterned so far. This also means that audio effects will not work. In the future, the integration could be improved by passing all patterned control parameters to the csound instrument. This could work by a unique channel for each value. Channels could be read like this. Also, it might make sense to have a standard library of csound instruments for strudel’s effects.

Now, let’s dive into the Functional JavaScript API