# Tracing multiple patterns of Pbinds in chunks

Is there an organised way to trace patterns of two arguments simultaneously in chunks, say 8 values?

It might be just me, but I don’t understand what you try to accomplish?

In any case, .trace has a “prefix” argument so you can easily distinguish different traces (not sure if that helps you in any way).

Example

``````(
p = Pbind(
\instrument, \default,
\midinote, Pseq([60,62,65,69], 1).trace(prefix:"note p "),
\dur, Pseq([0.1, 0.2], inf).trace(prefix:"dur p "),
);
q = Pbind(
\instrument, \default,
\midinote, Pseq([60,62,65,69], 1).trace(prefix:"note q "),
\dur, Prand([0.1, 0.2, 0.3], inf).trace(prefix:"dur q "),
);
Ppar([p,q]).play;
)
``````

Result

``````-> an EventStreamPlayer
note p 60
dur p 0.1
note q 60
dur q 0.3
note p 62
dur p 0.2
note q 62
dur q 0.3
note p 65
dur p 0.1
note p 69
dur p 0.2
note q 65
dur q 0.1
note q 69
dur q 0.2
``````

Thank! Ok this works. I just wanted to analyze further what multiple patterns output over four bars in order to pick parts of the sequence I like. It could be tricky when there are note patterns that don’t add up, ie \note, Pseq([7,5,0],inf) together with \octave, Pseq([1,2],inf) and lots of other arguments that don’t really add upp over a bar.

One way to do this might be to declare the Pbind as an asStream, and then call next on it, while providing an Event as an argument:

``````p = Pbind(*[x: Pseq((1 .. 3), inf), y: Pseq((1 .. 4), inf), z: Pwhite(0, 7)]);

t = p.asStream;

t.next( () ); // places the bound keys in an Event
``````

You can append `nextN` as well to simulating running `next(())` several times: `t.next( () ).nextN(8)`.

You may want to try something like this to track the current beat position within a bar (or any other desired state of the `TempoClock` your patterns run on):

``````(
p = Pbind(
\note, Pseq([7, 5, 0], inf),
\octave, Pseq([1, 2], inf),
\bib, Pfunc({ TempoClock.default.beatInBar })
);

p.trace(
key: [\note, \octave, \bib],
prefix: ["note: ", "octave: ", "beat in bar: "]
).play(quant: 1);
)
``````

Note the use of `.trace`'s `key` and `prefix` arguments.

Sorry for late replys. I been sick latley.
Thanks for the useful tips!