Last active
June 21, 2019 16:30
-
-
Save madskjeldgaard/861b4c73f9dc7571409b55d1a3185a82 to your computer and use it in GitHub Desktop.
Particular example for Balint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// boot server | |
s.boot; | |
// Init particular | |
p = Particular.new; | |
// Load a buffer with sound | |
b = Buffer.read(s, "~/path/to/sound.wav"); | |
// Number of outputs, this can be fun play with in patterns | |
~numOuts = 2; | |
~numOuts = ~numOuts-1; | |
// A pattern. | |
// Putting it in a pdef means you can live code it and change the parameters on the fly | |
Pdef(\g1, | |
Pbind( | |
\instrument, p.def("expodec", "buf2"), // first argument is grain envelope, second sound source type (buf1 for mono buffer, buf2 for stereo buffer) | |
\dur, Pwhite(0.05, 0.25), // dur is the sound event's duration | |
\start, Pwhite(0.0,0.9), // Random point in buffer | |
\sustain, 0.1*Pkey(\dur), // sustain is the grain "length", here at 10% of the event's duration | |
\rate, Pwhite(0.5, 5.0), // playback rate | |
\out, Pwhite(0, ~numOuts) | |
) | |
); | |
// Play the pattern | |
Pdef(\g1).play; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment