How can I step through events one by one and have each one sound?

Howdy hackers,

I know that if I have a stream of values

t = Pseq([16, 8, 24, 12, 36, 18, 9, 12, 8, 6, 27, 4] * 20, 1).asStream;

I can step through them by calling

t.next;

And if I wrap them in a Pbind, I can listen to them as frequencies:

Pbind(\freq, Pseq([16, 8, 24, 12, 36, 18, 9, 12, 8, 6, 27, 4] * 20, 1)).play;

But how can I step through them one by one and listen to each? The following posts what seems like a relevant stream. But no synths result.

p = Pbind(\freq, Pseq([16, 8, 24, 12, 36, 18, 9, 12, 8, 6, 27, 4] * 20, 1)).asStream;
p.next(());
p.next(());
p.next(());

And what is happening when I call .next(()) on my Pbind().asStream?

Welcome,

You have been almost there :slight_smile:
You got the Events returned (from the EventStream), in addition, you want to play them:

p.next(()).play;

Thanks for the welcome and the answer both!

There’s an answer to not only my first but also my second question is there in what you’ve said.

The -next method returns the next event from the stream. Each event is, roughly, a set of associated values. In relation to the EventStreamPlayer, it’s something like a score (or part of one).

Calling .next(Event.new) on a Pbind().asStream doesn’t yet return a player, but only a score or instruction for a player.

Thanks again!