Patterns in a sound file?

Patterns in a sound file ???

It is possible in SuperCollider?

I don-not know what I’m doing bad, because it doesn’t works.

Here the code.

PS: I’m not still a Genius in SC.

(\guitar, {
	arg amp=1, freq=4, dur=100;

~buf1 =, "/home/wrtrg789675/Musik/123.wav");
~buf2 =, "/home/wrtrg789675/Musik/457.wav");
{, ~buf1)}.play;
{, ~buf2)}.play;

(, 150, 10);
	\dur,Prand([0.25,0.5, 1/3, 1, 0.125],inf),
		Pseq([100, 63, 40, 56, 23],8),
		Prand([20, 59, 37, 70, 124, 80],5)

I don’t think your SynthDef knows what to do with amp, freq, and dur–those arguments aren’t actually used anywhere.

You can definitely use Patterns with buffers; I do it all the time. But I think you are expecting this SynthDef to do things it hasn’t been instructed to do. Your SynthDef arguments aren’t actually used in your SynthDef, so, for example, \freq isn’t doing anything. \dur is (I think) part of the standard Event prototype, so that one will work regardless and need not be an argument at all.

Here’s a good resource to get started with this kind of thing:

Thanks! I will review,

Hi @japan123

I think you need to start really with the basics of Supercollider to understand what you need. It would be best to start at the beginning learning to build a SynthDef before trying a Pbind. As @snythe said, look at some tutorials, maybe start with: 10. SynthDefs and Synths | SuperCollider 3.11.1 Help.

However, you might find following Eli Fieldsteel’s YouTube tutorials more interesting, they cover a lot, are practical and you can see (step-by-step) how to build the basics, up to more complex ideas - (SuperCollider Tutorial: 0. Introduction - YouTube) .

Lastly, since you posted an example of your idea - which didn’t work - here’s a really simple SynthDef and Pbind which should show you the basic first steps you might be looking for. I’m not sure what your soundfile is (I’ve used your example), but this should normally work if your soundfile has something that’s not too long (i.e. approx 1 second):

~soundFile =, "/home/wrtrg789675/Musik/123.wav"); // load a soundfile; // test your file
a) Build a simple SynthDef to play your file, using simple arguments.
b) There are several possibilities to play your soundfile, but first try a PlayBuf.
c) The buffer number and the rate (speed). The 'rate' can later be used in a similar way to 'freq'.  
d) The envelope (env) might be useful to control the length of your soundfile (stop/start).
SynthDef(\player, {
	arg bufNum = 0, rate = 1;
	var sig, env;
	env =, 1.0), doneAction:2);
	sig =, bufNum, rate, 1, doneAction:2);
	sig = sig * env;, sig);

Synth(\player, [\bufNum, ~soundFile]); // test your SynthDef + soundfile

// Build a simple Pbind. 
p = Pbind(
	\instrument, \player,
	\dur, 1 // Soundfile will play once per second.
p.stop; // Stop Pbind.

// Second Pbind using your 'rate' control/argument. 
p = Pbind(
	\instrument, \player,
	\dur, 1,
	\rate, 2, // Rate of soundfile - change this to hear pitch/speed.
	// Try 1 = original pitch/speed, 2 = Twice as fast, or 1 octave higher, etc.
p.stop; // Stop Pbind

Check out Eli’s youtube tutorials as you’ll more quickly understand what you need by following those.

I hope that helps a little.

dear joesh and dear snythe:
I’m actually take a SC workshop with Mexican Composer and Programmer Michel Soto, we:

Have seen:

  1. Modulation.
  2. SynthDefs, Additive Synthesis.
  3. Patterns. Subtractive Synthesis.
  4. GUI. more Subtractive Synthesis.
  5. FM Synthesis, build a Yamaha DX7.

there are still more (3 classes to attend) until July 3. The thing is that it is each Saturday and the code examples are very “espaciados” Spanish word, so you can fast forgot the code examples of the classes. So Today I’m reviewing all the 5 classes until tomorrow 2 AM.

So then I will get to cover the 2 tutorials you post to me and the joesh code example.

Best, Jose Ignacio


The first issue in your original example is: Never create or read buffers in a SynthDef. See 13. Buffers | SuperCollider 3.11.1 Help