Submit
Browse
Anonymous
Login
RSS
SuperCollider Code
Fork Code: example sequencing soundfiles
name
code content
//playing soundfiles in sequence - one after the other s.boot; ( s.latency= 0.05; b.do{|x| x.free}; //free all previous buffers b= [ //edit paths - any number of files - make sure mono Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-01.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-02.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-03.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-04.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-05.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-06.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-07.wav"), Buffer.read(s, "/Applications/SuperCollider344/sounds/samples/Screech-08.wav") ]; SynthDef(\sample, {|out= 0, buf, rate= 1| Out.ar(out, PlayBuf.ar(1, buf, rate, doneAction:2)!2); }).add; ) //test1 - single Synth(\sample, [\buf, b[0]]).register.onFree{"hello".postln};//should post when first soundfile done playing //test2 - looping through samples one after the other ( Routine({ var index= 0; var c= Condition.new; inf.do{ var a= Synth(\sample, [\buf, b[index], \rate, 1]).register; a.onFree{ ("playing index:"+index).postln; c.unhang; }; c.hang; index= index+1%b.size; //play in sequence //index= b.size.rand; //or play random }; }).play; )
code description
simple example showing how to play one soundfile after the other in a sequence. use as a template.
use markdown for formating
category tags
comma separated, i.g. "wild, siren" (do not enter default SC class names, please)
ancestor(s)
comma separated identificators, i.g. "1-C,1-1,1-4M,1-x"
Private?
the code will be accessible by direct url and not visible in public activity
signup to submit public code without captcha
comment of change