I used a routine to sequence a pattern for the drum sounds that I made. It is however horribly longwinded to make or alter the pattern. I realise now that I could have assigned each different SynthDef to a letter variable, which would have shortened the code a bit, but the overall method is unintuitive and not very elegant. After a bit of research, I found code for a simple drum machine on this website: http://superdupercollider.blogspot.com/2009/02/simple-drum-machine.html. This uses the pattern mechanism and is a lot nicer!
This is my code (using SynthDefs from the previous post):
Routine.new({
inf.do({ arg i;
var speed, speed2;
speed=0.2;
speed2= speed*2;
Synth(\kick,[\vol,4,\decay,2,\pitch,2,\filter,112]);
speed.wait;
Synth(\hats,[\vol,3,\decay,1]);
speed.wait;
Synth(\hats,[\vol,3,\decay,3]);
speed.wait;
Synth(\hats,[\vol,3,\decay,1]);
speed.wait;
Synth(\snare,[\vol,1,\decay,1,\pitch,5,\filter2,0]);
speed.wait;
Synth(\kick,[\vol,4,\decay,2,\pitch,2,\filter,2]);
speed.wait;
Synth(\hats,[\vol,3,\decay,1]);
speed.wait;
Synth(\hats,[\vol,3,\decay,1]);
speed.wait;
Synth(\hats,[\vol,3,\decay,1]);
speed.wait;
Synth(\cymbal);
Synth(\hats,[\vol,3,\decay,1]);
speed.wait;
Synth(\kick,[\vol,4,\decay,2,\pitch,1,\filter,112]);
speed2.wait;
Synth(\snare,[\vol,1,\decay,1,\pitch,5,\filter2,0]);
speed.wait;
Synth(\hats);
speed.wait;
Synth(\hats,[\vol,3,\decay,2]);
speed.wait;
Synth(\cymbal,[\pitch,1.2]);
speed.wait;
});}).play)
0 comments:
Post a Comment