Running Pdefn outside of a Pattern [solved]

Hi,
I’m looking for the best way to trigger a Pdefn from outside the pattern (where it’s originally nested). I’m busy playing my saxophone (so lack of hands to trigger stuff ‘when’ I’m playing). What I’m trying to do is set up an original Pdefn to trigger\rate in this case. Then write several different versions (of the \rate Pdefn) which I can use outside of the Pbindef. A simple example:

   (
   Pdefn(\rate, Pdef([1,2,3], inf));
   Pbindef(\ex,
      \instrument, \test, 
      \rate, Pdefn(\rate),
    etc....
    )

As an example I can manually change these outside to create different textures by evaluating each line as needed:

Pdefn(\rate, Pdef([3,4,5], inf));

Pdefn(\rate, Pdef([6,7,8], inf));

However, I have to manually select the line and run it. But, when I’m playing I’d like to be able to let these Pdefn trigger themselves (if you see what I mean), or run automatically, as an example two times, then three times, ad infinitum…

Pdefn(\rate, Pdef([3,4,5], inf)); x 2
Pdefn(\rate, Pdef([6,7,8], inf)); x 3

What would be the most logical way of doing this? To build a separate Pbind (with a quant), a Routine/Task? I suspect I’m going a long way about this problem, I’d much appreciate it if someone could point me in the right direction.

Thanks in advance - joesh

Seperate Pbinds, Routines, Tasks are of course all possible.
But what about putting the changes into MIDIFuncs / MIDIdefs and trigger them with a Softstep or something ?

Greetings

Daniel

That is a great idea, and indeed I should buy myself a midi controller foot pedal. However, just a present I need an idea for tomorrow, and the music shops here (Belgium) are closed Monday.

Any other suggestions welcome.

  • you can order right now a Softstep under < http://thomann.de/ >. However, I am not sure when the item is delivered.

  • a control surface similar to the Softstep using touchOSC on a mobile device

  • a GUI on SuperCollide similar to the Softstep using [Button], [View.keyDownAction], etc.

best,

prko

Indeed, maybe that’s the way to go (for now).

Thanks.

Okay, I decided to go for Button, but never having used a button before I’ve got stuck. This is what I’ve got so far, but how do I trigger my Pdefns?

(
Window.closeAll;
w=Window("rate changer",Rect(900,200,180,150))
.front
.alwaysOnTop_(true);

w.view.decorator_(FlowLayout(w.bounds, 30@30,20@20));

~button = Button(w.view, 100@100)
.states_([
	["Ebm", Color.black, Color.red],
    ["Eb", Color.black, Color.green],
	["F7", Color.white, Color.blue]
])
.action_({
	arg chord;
	var a, b, c;
	a = Pdefn(\rate, Pseq([0,3],inf).midiratio);
	b = Pdefn(\rate, Pseq([Pseq([0],3),Pseq([2],1)],inf).midiratio);
	c = Pdefn(\rate, Pseq([Pseq([0],4),Pseq([Prand([2,4],inf)],2)],inf).midiratio);
	????????????
});
)

Thanks for any help (in advance) - joesh

could you substitute the following part

.action_({
	arg chord;
	var a, b, c;
	a = Pdefn(\rate, Pseq([0,3],inf).midiratio);
	b = Pdefn(\rate, Pseq([Pseq([0],3),Pseq([2],1)],inf).midiratio);
	c = Pdefn(\rate, Pseq([Pseq([0],4),Pseq([Prand([2,4],inf)],2)],inf).midiratio);
	????????????
});

with the following part?

.action_{ |button|
	switch (button.value,
		0, { Pdefn(\rate, Pseq([0,3],inf).midiratio) },
		1, { Pdefn(\rate, Pseq([Pseq([0],3),Pseq([2],1)],inf).midiratio) },
		2, { Pdefn(\rate, Pseq([Pseq([0],4),Pseq([Prand([2,4],inf)],2)],inf).midiratio) }
	)
}

Please refer to http://doc.sccode.org/Reference/Control-Structures.html

That’s perfect.

Oddly enough I was just looking at ‘switch’ a minute ago, but couldn’t figure out the syntax I needed - with or without {a function} etc.

Big thanks - joesh

It is my pleasure.
I would thank if you could post here or under http://www.sccode.org a snippet of your code because I have been interested in the way that you control music. Would it be possible?

Indeed, what do you want me to post (as there’s lots of little pieces). It’s for a live music piece that I’m working on, I write snippets of ideas and then improvise with a drummer and take out what we don’t like (or develop what we do like).

Here’s a link to the player where I used the GUI code (I hope it’s correct, I’ve never posted anything there before), it should be under Rate Player: http://sccode.org/1-5aA

Thank you very much for your posting.
It seems to be a very efficient way of improvising.
Impressed!
Have a good luck at the concert!

1 Like

Thanks prko, I should be recording it in September so I’ll try to remember to post some of it so you can here what’s going on.

1 Like

Thanks a lot! :grinning: