«The Unfunky Drummer» by Schemawound

on 30 May'13 19:02 in randomunfunkydrumchaos

The Unfunky Drummer - Insert samples, extract joy. Code by Jonathan Siemasko http://www.schemawound.com/

NOTE: Set values for ~synthDefToUse, ~rate and ~source before running.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
(
fork{
	//---------Source Files---------
	~numOfPatterns = 16;
	~synthDefToUse = \bufPlay; //Change to \bufPlay2 to use stereo samples
	~rate = 2; //Rate of playback
	~source = [ // Create an array of your samples. ~media.samples points at my base sample directory and is defined in my startup file.
		~media.samples ++ "808/kicks/808 kick 6.wav",
		~media.samples ++ "808/snares/808 snare 6.wav",
		~media.samples ++ "808/hats/808 hat 2.wav",
		~media.samples ++ "808/other/808 cowbell.wav",
		~media.samples ++ "808/other/808 clap.wav",
		~media.samples ++ "808/other/808 rim.wav",
		~media.samples ++ "808/other/808 maraca.wav"
	];
	Buffer.freeAll;
	~buffers = ~source.collect{|source| Buffer.read(s, source)};
	~patterns = ~numOfPatterns.collect{|val| Pbind(*[dur: Pn(1/val, val)])};
	~randPattern = Prand(~patterns, 1);
	~patterns = ~buffers.collect{|buf| Pbind(*[bufnum: buf]) <> ~randPattern};
	SynthDef(\bufPlay, {|out = 0, bufnum, rateScale = 1, amp = 1| Out.ar(out, PlayBuf.ar(1, bufnum, BufRateScale.kr(bufnum) * rateScale, doneAction: 2) * amp!2);}).add;
	SynthDef(\bufPlay2, {|out = 0, bufnum, rateScale = 1, amp = 1| Out.ar(out, PlayBuf.ar(2, bufnum, BufRateScale.kr(bufnum) * rateScale, doneAction: 2) * amp);}).add;
	s.sync;
	Ppar(~patterns, inf).play(TempoClock(~rate, 0), protoEvent: (instrument: ~synthDefToUse, amp: 0.25));  //Change to /bufPlay2 for stereo samples
};
)
raw 1416 chars (focus & ctrl+a+c to copy)
reception
comments
Schemawound user 30 May'13 19:10

Discovered you can also have a lot of fun by turning down the rate and turning up the number of patterns. Try 0.3 and 60

Schemawound user 30 May'13 19:11

Extracted number of patterns to ~numOfPatterns to make it easier to mess with.