2

I'd like to add a very simple "humanisation" to some note patterns, by randomly jittering the time that the notes play. This code repeatedly plays a chord:

p = Pbind(\legato, 0.1, \dur, 0.2, \midinote, [66, 69, 74]).play

But I'd like each of the three notes in the chord to randomly have some independent "error" in the exact timing. I do not want the tempo to vary.

Dan Stowell
  • 4,618
  • 2
  • 20
  • 30

1 Answers1

3

There's a key you can use called \timingOffset - described in section 8 of the pattern guide.

The simple example is:

p = Pbind(\legato, 0.1, \dur, 0.4, \midinote, [66, 69, 74], 
       \timingOffset, Pwhite(-0.1, 0.1)
    ).play;

so that's a random offset of +-0.1 beats. Unfortunately it applies one deviation to the whole chord, which is not what you want. So you need to feed an array into the Pwhite:

p = Pbind(\legato, 0.1, \dur, 0.4, \midinote, [66, 69, 74], 
       \timingOffset, Pwhite([-0.1, -0.1, -0.1], [0.1, 0.1, 0.1])
    ).play;

and of course you can derive those arrays from some value:

~jitter = 0.1;
p = Pbind(\legato, 0.1, \dur, 0.4, \midinote, [66, 69, 74], 
       \timingOffset, Pwhite({0-~jitter}.dup(3), {~jitter}.dup(3))
    ).play;

Here's a slightly different approach which makes the right number of values, in case the array size of "midinote" is variable:

~jitter = 0.1;
p = Pbind(\legato, 0.1, \dur, 0.4, \midinote, [66, 69, 74], 
\timingOffset, Pcollect({|val| {~jitter.bilinrand}.dup(val.size)}, Pkey(\midinote))
    ).play;
Dan Stowell
  • 4,618
  • 2
  • 20
  • 30