Looping an Event Pattern (Pbind etc)

Hello everyone

For a while I have wanted a pattern class that I could use to record and loop events from a Pbind in a manner similar to an audio “live looper”. I’ve finally given it a go and made the Ploop class. You can turn recording on/off as well as the playback on/off. When playback is off it just passes the incoming events on, but if playback is on it outputs the events it has recorded in it’s buffer.

Here is how to use it:

(
// When this is 1, it plays the events in the buffer, when it is 0, it records them
var playing = Pstep([0, 1],4,inf);
var maxNumEvents = 4; // The number of events to loop/record

// The pattern to record/play. Just a melody with the first 10 degrees of the default scale.
p = Pbind(\degree, Pseq((0..9), inf), \dur, 0.125);

// Pass the Pbind through the looper
p = Ploop.new(p, maxEvents: maxNumEvents, recording: 1 - playing, playing: playing);

// play
p.play;
)

And here is the class. You can download this class and add to your extensions, or you can install my Monolithic quark (which is… monolithic).

If you have any feedback I’d like to hear it :slight_smile:

2 Likes