How to generate paradiddles?

Hello,

are you aware of any code that can generate single, double, triple paradiddles?

thank you! k

hi krisztian, i think it’s a good idea to try writing it yourself rather than asking the forum to write your code for you. what have you tried so far? is there anything in particular that you’re stuck on?

If paradiddles are grace notes before the beat, then there’s:

  • Main note A
  • Grace note(s)
  • Main note B

You’ll need to shorten main note A by the total duration of the grace notes.

Tricky to do in patterns. You might try a Routine or Prout.

hjh

hi nathan. apologies, my question above sounds ignorant. just wished for some guidance. often it turns out that others have done good work on specific things related to rhythm e.g. Fredrik’s Bjorklund quark.

Thanks James.

What got me started on this was a 2010 paper by Toussaint: Generating “Good” Musical Rhythms Algorithmically.

single:

double:

tripple:

I might end up with a function generating an Array using some 'if’s. Then the arrays could be ‘played’ by a Routine, TempoClock, etc.

cheers, k

i’m realizing now that my previous comment came off as unnecessarily cranky, sorry about that! i just think it’s better if you take a crack at it and let us know if run into more specific questions.

1 Like

In the function, how could I

  1. duplicate the first part of the array (a) and
  2. swap the 0s and 1s in the duplicated (second half)

so that I get:

[ 0, 1, 0, 0, 1, 0, 1, 1 ] //single;
[ 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 1 ] //double
[ 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 1, 1 ] //triple

?

(
~gen = { |bpb,x|
a = nil ! bpb;
(a.size/2).asInt.do{ |b|
if(b<x,
{a[b] = b%2}, //true
{a[b] = a[0]} //false
);
};
a.postln;
}
)

~gen.value(8,3); //single
// posts: [ 0, 1, 0, 0, nil, nil, nil, nil ]
~gen.value(12,5); //double
// posts: [ 0, 1, 0, 1, 0, 0, nil, nil, nil, nil, nil, nil ]
~gen.value(16,7); //triple
// posts: [ 0, 1, 0, 1, 0, 1, 0, 0, nil, nil, nil, nil, nil, nil, nil, nil ]

cheers! k

Hi Rodet, I’m teaching jazz at college, and sometimes paradiddles come up in conversation (although I’m not a drummer). A paradiddle is basically a way of ‘evenly’ playing a roll (single/double/triple/whatever). If you take your drumsticks/fingers and play evenly:

right, left, right, right, left, right, left, left, right, left, right, right, etc

you’ll notice that it’s possible to get an even rhythm, which when played fast becomes a roll. The idea of the single/double/triple is just to place the accents (lightly, or not) on the left, right hand, which if I understand helps keep an even stroke (and makes better sense to follow).

So, although I don’t know the goal of your idea, a simple code which would give you the solution could be a pattern. You’ll notice I’ve put in a SynthDef to give the ‘snare’ sound - not very real, but just for the demonstration. If you run these patterns, un-commenting the line needed (single, double or triple - don’t forget to comment out the lines you don’t need), you’ll hear the accents a paradiddle gives.

In this example Pbind ‘a’ gives the pulse, and Pbind ‘b’ the accents. And, if you play along with them (using your chart), you’ll notice the accents pass from right hand to left hand (or vice versa). This is (more or less) what paradiddles do, although a drummer will explain better how they ‘accent’ strokes to get more complicated/subtle rhythms.

(
SynthDef(\snare, {
	arg out=0, sus=0.1;
	var sig, env;
	sig = WhiteNoise.ar(0.1);
	env = EnvGen.kr(Env.perc(0.001, sus), doneAction:2);
	sig = sig*env;
	Out.ar(out, sig!2);
}).add;
)

(
t=TempoClock(80/60);
a=Pbind(
	\instrument, \snare,
	\dur, 1/2,
	\sus, 0.01
);
b=Pbind(
	\instrument, \snare,
	\dur, 1,
	\sus, Pseq([0.02, 0.01],inf), // single
	//\sus, Pseq([0.02, 0.01, 0.01],inf), // double
	//\sus, Pseq([0.02, 0.01, 0.01, 0.01],inf), // triple
);
Ppar([a, b]).play(t);
)

I hope that puts you on the right track.

p.s. Don’t forget to try out changing the speed to get the real effect. Try something like 320/60 on the TempoClock.

1 Like

To strictly answer your question, this is a simple way to do what you ask:

(
  a  = [ 0, 1, 0, 0, 1, 0, 1, 1 ]; //single;
  b = 1 - a; // flip all ones and zeros 
  c = a ++ b; //concatenate the results
)

resulting in

-> [ 0, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 0, 1, 0, 0 ]
1 Like

Hi Joesh,

many thanks for taking the time for your reply. The ‘music’ generated with your code sounds similar to the effect needed and it gave me an interesting approach to consider. I might end up end having to looking into Patterns eventually - I have always been working with TempoClock + Routines/Tasks/Functions.

Yes, the faster tempo gives it more of the drum roll effect!

Cheers! k

Thanks @shiihs, works!

(
~gen = { |bpb,x|
a = nil ! (bpb/2);
a.size.asInt.do{ |i|
if(i<x,
{a[i] = i%2}, //true
{a[i] = a[0]} //false
);
};
a.postln;
b = 1 - a; // flip all ones and zeros
c = a ++ b; //concatenate the results
c.postln;
}
)

~gen.value(8,3); //single
~gen.value(12,5); //double
~gen.value(16,7); //triple

hi rodet

Thanks for the reply. As I said, and I’m sure others would agree, it always depends on what you’re planning to do - with whatever. If it’s music, then maybe patterns could be a way to go, giving you plenty of room for development, especially if you turn them into Pbindef or use ProxySpace for live coding, etc.

I’m often working on drum patterns and sounds. It’s, in my humble opinion, one of the most difficult things to get working, and sound natural. However, it’s a lot of fun, and you learn a lot about Patterns, TempoClocks and also Synthdefs by trying to master this area.

Good luck.

1 Like

Thanks Joesh,

Yes, I got interested in Ndef ‘style’ live coding a few months ago.

The natural sound, yes, I am after that as well! The sequencer I have been building triggers short sound recordings made on a frame drum. I will try to connect this paradiddle part to the rest and perhaps ask for feedback on how natural it sounds :slight_smile:

Earlier I got help here for loading a whole folder of audio samples into buffers, so now the sequencer can somewhat randomly choose between a large number of ‘almost’ identical sounds - hopefully this will add some umami!

Cheers, k

When talking about “natural” sound, I guess one should also consider adding subtle “errors” (random variations) in timing and velocity to each note, preferably in a clever way to ensure that overall timing after a while doesn’t get hopelessly out of sync and that volumes do not derail.

2 Likes