Skip to content

Instantly share code, notes, and snippets.

@madskjeldgaard
Last active June 21, 2019 16:30
Show Gist options
  • Save madskjeldgaard/861b4c73f9dc7571409b55d1a3185a82 to your computer and use it in GitHub Desktop.
Save madskjeldgaard/861b4c73f9dc7571409b55d1a3185a82 to your computer and use it in GitHub Desktop.
Particular example for Balint
// 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