This commit is contained in:
nik gaffney 2018-05-10 21:21:36 +02:00
parent eed4f352d7
commit 09f845431d

View file

@ -19,53 +19,54 @@ s.boot;
"...".postln; "...".postln;
~prefix = Platform.userHomeDir ++ "/snd/";
~background = { ~background = {
"background >> ".post; "background >> ".post;
// list of soundfiles // list of soundfiles
~sources = [ ~sources = [
"/home/foam/snd/39-incomprehensible-restaurtant-chatter-02.wav", "39-incomprehensible-restaurtant-chatter-02.wav",
"/home/foam/snd/39-incomprehensible-restaurtant-chatter-03.wav", "39-incomprehensible-restaurtant-chatter-03.wav",
"/home/foam/snd/39-incomprehensible-restaurtant-chatter-04.wav", "39-incomprehensible-restaurtant-chatter-04.wav",
"/home/foam/snd/46-afternoon-chorus-02.wav", "46-afternoon-chorus-02.wav",
"/home/foam/snd/46-afternoon-chorus-03.wav", "46-afternoon-chorus-03.wav",
"/home/foam/snd/46-afternoon-chorus-04.wav", "46-afternoon-chorus-04.wav",
]; ];
// select random element from the list // select random element from the list
~file = ~sources.choose; ~file = ~sources.choose;
~file.postln; ~file.postln;
// read file then play buffer // read file then play buffer
Buffer.read (server: s, path: ~file, action: ~play1); Buffer.read (server: s, path: ~prefix++~file, action: ~play1);
}; };
~foreground = { ~foreground = {
"foreground >> ".post; "foreground >> ".post;
// list of soundfiles // list of soundfiles
~sources = [ ~sources = [
"/home/foam/snd/26-multilayered-conversations-01.wav", "26-multilayered-conversations-01.wav",
"/home/foam/snd/26-multilayered-conversations-02.wav", "26-multilayered-conversations-02.wav",
"/home/foam/snd/39-incomprehensible-restaurtant-chatter-02.wav", "39-incomprehensible-restaurtant-chatter-02.wav",
"/home/foam/snd/39-incomprehensible-restaurtant-chatter-03.wav", "39-incomprehensible-restaurtant-chatter-03.wav",
"/home/foam/snd/39-incomprehensible-restaurtant-chatter-04.wav", "39-incomprehensible-restaurtant-chatter-04.wav",
"/home/foam/snd/26-party-chatter-02.wav", "26-party-chatter-02.wav",
"/home/foam/snd/26-party-chatter-03.wav", "26-party-chatter-03.wav",
"/home/foam/snd/26-party-chatter-04.wav", "26-party-chatter-04.wav",
"/home/foam/snd/06-uw-pebbles-urchins-waves.wav", "06-uw-pebbles-urchins-waves.wav",
"/home/foam/snd/17-uw-waves-crashing-on-pebble-beach-slow.wav" "17-uw-waves-crashing-on-pebble-beach-slow.wav"
]; ];
// select random element from the list // select random element from the list
~file = ~sources.choose; ~file = ~sources.choose;
~file.postln; ~file.postln;
// read file then play buffer // read file then play buffer
Buffer.read (server: s, path: ~file, action: ~play2); Buffer.read (server: s, path: ~prefix++~file, action: ~play2);
}; };
~play1 = { arg b1; ~play1 = { arg b1;
@ -74,10 +75,10 @@ s.boot;
{(PlayBuf.ar(1, b1, rate: 1, loop: 0, doneAction: 2) * 0.1).dup }.play.waitForFree; {(PlayBuf.ar(1, b1, rate: 1, loop: 0, doneAction: 2) * 0.1).dup }.play.waitForFree;
// free buffer once done? // free buffer once done?
"freed [bg - ".post; b1.path.post; "]".postln; "freed [bg - ".post; b1.path.post; "]".postln;
b1.free; b1.free;
~background.value; ~background.value;
}.play; }.play;
}; };
@ -87,10 +88,10 @@ s.boot;
{(PlayBuf.ar(1, b2, rate: 1, loop: 0, doneAction: 2) * 0.1).dup }.play.waitForFree; {(PlayBuf.ar(1, b2, rate: 1, loop: 0, doneAction: 2) * 0.1).dup }.play.waitForFree;
// free buffer once done? // free buffer once done?
"freed [fg - ".post; b2.path.post; "]".postln; "freed [fg - ".post; b2.path.post; "]".postln;
b2.free; b2.free;
~foreground.value; ~foreground.value;
}.play; }.play;
}; };
@ -111,7 +112,7 @@ s.waitForBoot {
// 167/31 -> 175/31 -> 168/31 // 167/31 -> 175/31 -> 168/31
// via http://danielnouri.org/docs/SuperColliderHelp/Tutorials/Getting-Started/Buffers.html // via http://danielnouri.org/docs/SuperColliderHelp/Tutorials/Getting-Started/Buffers.html
// Streaming a File in From Disk // Streaming a File in From Disk