[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-users] Integrating Events and Patterns



Hi Daniel -

The reason for the reversal is a little convoluted, maybe. I have been archiving the Events and using them to replace other Pbindefs while playing. This means archived Events are a little truncated because their key names are removed.  Events are inserted into new Pbindefs, which then need to be converted back to Events, in order to use EnvirGUI.

I'm sure there is something I'm just not grasping here - and I'm sorry to be nuisance about it!  Maybe this all makes more sense with PLbindef, which I will look into immediately.

The overall code would actually look a little more like this:

(
~patt = "( 'sus': Pwhite(0.5, 0.8), 'rel': Pwhite(0.01, 0.3), 'degree': Pseq([ 0, 2, 3, 4 ], inf), 'dur': Pseq([ 0.2 ], inf),
  'octave': Prand([ 5 ], inf), 'dec': Pseq([ 0, 2, 3, 4 ], inf), 'instrument': 'nil')";
~patt = ~patt.interpret;
~patt = ~patt.array;
~finalPatt = {|m| ~patt};
);
(
n = Pbindef(\d, *~finalPatt.());
e = PbindefEvent(n);
w = Window("", Rect(0, 0, 300, 300));
PdefGui(n, parent: w, bounds: Rect(0, 0, 50, 10));
q=EnvirGui(e, 24, parent: w, bounds: Rect(40, 0, 600, 90));
w.front;
);

Thanks again for all of the help - I really do appreciate all of the work you've done for the SC community.




On Tue, Jun 8, 2021 at 11:45 AM <daniel-mayer@xxxxxxxx> wrote:
Hi,

you’re refering to this thread:

https://www.listarc.bham.ac.uk/lists/sc-users-2014/msg40239.html

PbindefEvent makes an Event from a Pbindef, so actually I don’t get the usage in this new example. Wouldn’t you want the opposite ?

Like

e = ( 'sus': Pwhite(0.5, 0.8), 'rel': Pwhite(0.01, 0.3), 'degree': Pseq([ 0, 2, 3, 4 ], inf), 'dur': Pseq([ 0.2 ], inf),
  'octave': Prand([ 5 ], inf), 'dec': Pseq([ 0, 2, 3, 4 ], inf), 'instrument': nil);

Pbindef(\e, *e.asKeyValuePairs).play

Pbindef(\e).stop

By the way: as the thread is from 2014: you might want to check out PLx patterns (from 2015) and especially PLbindef / PLbindefPar (2016), wrappers of Pbindef that attempt to shorten replacement syntax.

Greetings

Daniel

-----------------------------
http://daniel-mayer.at
-----------------------------