Samples
Playback of authored audio: teacher uploads, story narration, arcade voice lines, ambience beds. The engine names these sounds because the engine owns the content; SuperCollider loads and plays them. Game feedback — the chime when a hold is hit — is NOT a sample the engine asks for: SuperCollider chooses it from the mode’s own messages.
Messages
Section titled “Messages”/sample/load
Load an audio file into memory under a key.
ss -
keys string - The name everything else will use for this sound, e.g. "savanna/giraffe". Letters, digits, dashes and slashes. Loading a key that is already loaded replaces it.
-
paths string - File path relative to the /sys/assets root. WAV, AIFF or FLAC; mono or stereo.
Acknowledged by /sample/loaded.
/sample/load savanna/giraffe stories/savanna/giraffe.wav NetAddr("127.0.0.1", 57120).sendMsg('/sample/load', "savanna/giraffe", "stories/savanna/giraffe.wav"); osc.Send(Osc.SampleLoad, "savanna/giraffe", "stories/savanna/giraffe.wav"); Load everything a mode will name before /mode/load, then wait for every /sample/loaded. Loading reads from disk and is not instant; a sample played before it has loaded is silence.
Marked `rate: state` on purpose: the set of loaded samples is state, and after a SuperCollider restart the engine re-sends every /sample/load as part of /sys/sync.
/sample/loaded
A sample has finished loading, or failed to.
sifs -
keys string - The key from /sample/load.
-
oki int32 0 | 1 - 1 on success, 0 on failure.
-
durationf float32 seconds - Length of the file. 0.0 on failure.
-
details string - Empty on success; the reason on failure, e.g. "file not found".
/sample/loaded savanna/giraffe 1 2.4 ~osc[\sampleLoaded].value("savanna/giraffe", 1, 2.4, ""); // handler for Osc.SampleLoaded /sample/free
Release a sample's memory.
s -
keys string - The key to free. Freeing an unknown key is a no-op.
/sample/free savanna/giraffe NetAddr("127.0.0.1", 57120).sendMsg('/sample/free', "savanna/giraffe"); osc.Send(Osc.SampleFree, "savanna/giraffe"); Stops any instance still playing first. Free a story's samples when leaving the mode; a day of uploads adds up.
/sample/play
Play a loaded sample.
ssffi -
keys string - A key that has been loaded. Unknown keys are logged and ignored.
-
buss string "voice" | "music" | "ambience" | "sfx" | "content" - Which mix bus it plays on — see /audio/bus/volume.
-
gainf float32 0.0 – 1.0normalizeddefault 1.0 - Level for this instance, before the bus level.
-
panf float32 -1.0 – 1.0default 0.0 - Horizontal position across the wall, -1.0 left edge to 1.0 right edge. Narration stays at 0.0.
-
loopi int32 0 | 1default 0 - 1 loops until /sample/stop — for ambience beds.
/sample/play savanna/narration-01 voice 1.0 0.0 0 NetAddr("127.0.0.1", 57120).sendMsg('/sample/play', "savanna/narration-01", "voice", 1.0, 0.0, 0); osc.Send(Osc.SamplePlay, "savanna/narration-01", "voice", 1.0f, 0.0f, 0); Playing a key that is already playing starts a second instance. A non-looping instance reports /sample/ended when it finishes.
/sample/stop
Stop every playing instance of a sample.
sf -
keys string - The key to stop.
-
fadef float32 0.0 – 10.0secondsdefault 0.1 - Fade-out time. 0.0 cuts instantly, which will click.
/sample/stop savanna/ambience 2.0 NetAddr("127.0.0.1", 57120).sendMsg('/sample/stop', "savanna/ambience", 2.0); osc.Send(Osc.SampleStop, "savanna/ambience", 2.0f); /sample/ended
A sample instance has stopped playing.
si -
keys string - The key that stopped.
-
completedi int32 0 | 1 - 1 if it played to the end, 0 if it was stopped or cut off.
/sample/ended savanna/narration-01 1 ~osc[\sampleEnded].value("savanna/narration-01", 1); // handler for Osc.SampleEnded This is how the engine sequences narration against lights: play a line, wait for its /sample/ended, light the next hold. SuperCollider knows exactly when audio finishes; the engine can only guess from the duration, and the guess drifts.
Looping instances report only when stopped.