How can I play a single Event inside a specific clock and set quantization?
It seems ().play does not accept clock: nor quant: messages.
The shortest I could come up so far is to specify a very short Pbind:
Pbind(\dur, Pseq([1],1)).play(t, quant: 1);
or a Routine containing a Synth.new object.
I think “do something inside a specific clock and set quantization” sounds like you want a Routine as you proposed…
{ ().play }.fork(quant: ...)
If you want something more streamlined for frequent personal use you could write a method that extends Event which would do this for you. For example, save the following in a file ending with .sc somewhere in your Extensions folder:
But being aware that you’d have to share this extension if you want to share code that makes use of it. Also it is actually more characters to type, but maybe looks a little cleaner.
clock: and quant: are relevant for scheduling an activity on a clock.
But .play doesn’t mean “schedule something on a clock” – not universally.
Objects respond to requests in a way that makes sense for them. For Routines, Tasks, patterns (including Pdef), the thing has to run on a clock, so you see clock and quant arguments here.
{ }.play doesn’t follow suit, though. A function can be either an activity or a synthesis definition. It’s convenient to be able to play a synthesis definition in one shot, so { }.play takes the audio-play meaning and has no clock/quant parameters at all. (To schedule a function, use sched or schedAbs called on a clock.)
Playing an event is more related to the audio side. It doesn’t schedule its work for the future; it just does the work right now, on whatever clock is active at the moment. So the way to schedule an event.play is… to schedule the method call. The one-shot routine proposed above does this. The clock’s scheduling methods would also work, although resolving the quant is slightly less convenient that way.
It’s a reasonable guess that play = scheduling, but this isn’t true for all objects.