User Tools

Site Tools


supercollider

This is an old revision of the document!


Directions

Use the jmg/supercollider branch until it's merged into main.

Install supercollider and tcl-udp through apt. Configure jack to use your audio device in folk/virtual-programs/music.folk. Ignore the tidal error for now (TODO: handle this more gracefully).

Add yourself to the audio group.

Starting code to make audio:

Wish Supercollider plays sound foo {
    Pan2.ar(SinOsc.ar(440) * 0.5, 0.0); // This is Supercollider synth code
}

Code to play a note when it is wished for:

When /player/ wishes to play note /note/ {
    set noteAscii [scan $note %c]
    set noteIdx [expr { $noteAscii - 0x41 }]
    set noteFreq [expr { 440.0 * (2.0 ** ($noteIdx / 12.0)) }]
    Wish $player is labelled "noteFreq is $noteFreq"
    set soundName note-$player-$note
    Wish Supercollider sound $soundName attr freq is $noteFreq
    Wish Supercollider plays sound note-$player-$note {
        arg freq = 440.0;
        var envgen;
        envgen = EnvGen.kr(Env.adsr(sustainLevel: 0.2));
        Pan2.ar(SinOsc.ar(freq) * 0.5 * envgen, 0.0);
    }
}

May need to kill/restart jackdbus randomly.

For testing, try running the Supercollider interpreter separately with QT_QPA_PLATFORM=offscreen sclang.

supercollider.1726426434.txt.gz · Last modified: 2024/09/15 18:53 by discord

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki