supercollider
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
supercollider [2024/09/15 19:26] – discord | supercollider [2025/03/05 19:10] (current) – smj-edison | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Directions ====== | ====== Directions ====== | ||
- | Use the '' | + | Use the '' |
* '' | * '' | ||
- | Install '' | + | Install '' |
- | * '' | + | * '' |
Add yourself to the audio group and reboot. | Add yourself to the audio group and reboot. | ||
Line 17: | Line 17: | ||
* This is a bit more involved. | * This is a bit more involved. | ||
- | * Start by running '' | + | |
- | * You'll get a huge list of audio device. Try and find one that says something about HD-Audio, being generic, and being analog. You'll want the string that looks like '' | + | * <file bash> |
- | * Now, go to '' | + | * Or, manually: |
+ | * Start by running '' | ||
+ | | ||
+ | * Now, go to '' | ||
* Add a section that looks like this: | * Add a section that looks like this: | ||
* <file tcl> | * <file tcl> | ||
Line 29: | Line 32: | ||
[... rest of ifs] | [... rest of ifs] | ||
</ | </ | ||
+ | * Install the SuperDirt library by running <file bash> | ||
* It should be set up! | * It should be set up! | ||
Line 41: | Line 45: | ||
Code to play a note when it is wished for: | Code to play a note when it is wished for: | ||
<file tcl> | <file tcl> | ||
+ | set noteSemitones [dict create A 0 B 2 C 3 D 5 E 7 F 8 G 10] | ||
+ | set accidentalSemitones [dict create "#" | ||
+ | |||
When /player/ wishes to play note /note/ { | When /player/ wishes to play note /note/ { | ||
- | set noteAscii | + | |
- | set noteIdx | + | |
- | set noteFreq [expr { 440.0 * (2.0 ** ($noteIdx | + | set modSt [dict get $accidentalSemitones $accidental] |
- | Wish $player is labelled " | + | set st [expr { $noteSt + $modSt |
+ | set noteFreq [expr { 440.0 * (2.0 ** (($octave == "" | ||
set soundName note-$player-$note | set soundName note-$player-$note | ||
Wish Supercollider sound $soundName attr freq is $noteFreq | Wish Supercollider sound $soundName attr freq is $noteFreq | ||
- | Wish Supercollider plays sound note-$player-$note | + | Wish Supercollider plays sound $soundName |
arg freq = 440.0; | arg freq = 440.0; | ||
var envgen; | var envgen; | ||
- | envgen = EnvGen.kr(Env.adsr(sustainLevel: | + | envgen = EnvGen.kr(Env.adsr(sustainLevel: |
- | Pan2.ar(SinOsc.ar(freq) * 0.5 * envgen, 0.0); | + | Pan2.ar(Saw.ar(freq) * 0.5 * envgen, 0.0); |
} | } | ||
+ | |||
+ | When the clock time is /t/ { | ||
+ | When /nobody/ claims $soundName has start time /startTime/ { | ||
+ | Hold $soundName { Claim $soundName has start time $t } | ||
+ | } | ||
+ | When $player has region /r/ & $soundName has start time /startTime/ { | ||
+ | # set radius [expr { max([region width $r], [region height $r])/2 + 10 }] | ||
+ | set radius [expr { ($t - $startTime) * 500 }] | ||
+ | Wish $player draws a circle with radius $radius color red | ||
+ | } | ||
+ | } | ||
+ | On unmatch { Hold $soundName { } } | ||
} | } | ||
</ | </ | ||
Line 85: | Line 105: | ||
s = t; | s = t; | ||
</ | </ | ||
+ | |||
+ | TODO: add audio debugging page that can be printed? |
supercollider.1726428389.txt.gz · Last modified: 2024/09/15 19:26 by discord