How do I stop a Pmono?

486 views Asked by At

I read through the documentation of Pmono and must have read it wrong. From the following I inferred that the node Pmono creates would be deleted after the Pmono finishes:

"This node is created when entering a Pmono, and released when the Pmono terminates."

So I thought a Pmono like this:

p = Pmono(\default, \dur, 0.2, \freq, 400).play;

...would create a Synth that played for 0.2 seconds and then get released automatically. However, it keeps playing forever, which makes me wonder what the \dur, 0.2 relates to.

How do I kill the Pmono when I don't want it anymore? Or possibly more to the point, is there a Pthing which means 'Create this monophonic synth, to which I can continue to send control data after it's started up, and which is released automatically at the end of the pattern'?

Edit: some more context of what I'm trying to do: I would like to be able to create an instance of an expensive effects synth, which I only want for a bar or so, which just automatically gets released after I've finished with it.

1

There are 1 answers

2
Dan Stowell On BEST ANSWER

The first thing to understand is why it keeps playing forever rather than just 0.2. You can see what's going on if you run the Pbind equivalent:

 p = Pbind(\instrument, \default, \dur, 0.2, \freq, 400).play;

If you run this you don't just hear a single note, you hear the note being hit again and again forever, until you run

 p.stop;

So why is that? It's because all of the "values" specified are simple numbers or symbols (\default ... 0.2 ... 400), and these are always interpreted as meaning "continue forever or until something else stops us".

If you wanted Pbind to play just one note you would need to use at least one pattern in there which limits itself to just one item:

 p = Pbind(\instrument, \default, \dur, 0.2, \freq, Pseq([400], 1)).play;

So you can do the same thing with Pmono:

 p = Pmono(\default, \dur, 0.2, \freq, Pseq([400], 1)).play;

This has exactly the same result as the Pbind example, actually, but that's because it's playing only one note. We can make the difference a little bit clearer with these two-note examples:

 p = Pbind(\instrument, \default, \dur, 0.4, \freq, Pseq([400, 500], 1)).play;

 p = Pmono(\default, \dur, 0.4, \freq, Pseq([400, 500], 1)).play;

The first plays two separate notes, the second plays one with a pitch change halfway through.

So, note that your inference was correct - the node does get deleted after the Pmono terminates - but your Pmono was not terminating.