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

Re: [sc-users] Immediate Pattern Update via Environment



On Wednesday 11 March 2009 10:20:24 Ataxian wrote:
> Pbindef has the same problem in that it will start at the first \midinote
> each time it is sent:
>
> Pbindef(\Pattern1, \instrument, "bass").play;
> Pbindef(\Pattern1, \midinote, Pseq([100, 69, 70], inf).asStream);
>
> Pdefn(\Pattern1).event.place(\midinote, Pseq([36, 37, 38, 39, 51, 41,
> 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], inf));
>
> This doesn't work as the message is not understood by SC?!
>
> There must be a conventional way of updating only certain notes in a
> pattern on-the-fly with SC, it would seem a crazy omission otherwise.

Pseq has an offset argument, so if you know where you are in the pattern, you 
can use that argument to determine where the new pattern starts.
I don't think there is a defined way to do this yet.


Just to be sure, you want to do something like this:

\midinote, Pseq([36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,50, 
51], inf)

pattern plays up until the note 40.
You replace the pattern with this:

\midinote, Pseq([36, 37, 38, 39, 40, 44, 43, 42, 41, 45, 46, 47, 48, 49,50, 
51], inf)

and you want it to continue with 44, 43, 42... 

This would work, but you'd have to time it right:

\midinote, Pseq([36, 37, 38, 39, 40, 44, 43, 42, 41, 45, 46, 47, 48, 49,50, 
51], inf, 5)

So basically you would like a way to:
* keep track of how many (N) events have been produced from a pattern
* replace one or more keys within the pattern (on the fly), and have them 
start from a state as if they had already produced N events, and are 
continuing.

I agree that that would be very useful :)

So, I'll leave it to the wise Pattern-gentlemen to show us the way...

sincerely,
Marije

>
> Thanks for your help so far.
>
> Julian Rohrhuber wrote:
> >>  > for me it seems to change immediately.
> >>>
> >>>  I needed to use store rather than load.
> >>>
> >>>  if you write:
> >>>  \midinote, Pfunc { e.midinote },
> >>>
> >>>  this should work out.
> >>
> >>Thank you Julian.
> >>
> >>This only brings to mind two other questions though, if I may?
> >>
> >>With the following in place:
> >>
> >>(
> >>	// Set Pattern1 environment first with initial values
> >>	Pdefn(\Pattern1).set
> >>		(
> >>			\instrument, "bass",
> >>			\midinote, Pseq([36, 37, 38, 39, 40, 41, 42,
> >>43, 44, 45, 46, 47, 48, 49,
> >>50, 51], inf).asStream,
> >>			\dur, Pseq([1.0,1.0,1.0,1.0], inf),
> >>			\legato, Pseq([0.9, 0.3, 0.3, 0.3, 0.3], 1),
> >>			\amp, 0.5,
> >>			\detune, 0.005
> >>		);
> >>	// Need to refer to Pattern1 environment in some way so
> >>create a variable =
> >>envir
> >>	e = Pdefn(\Pattern1).envir;
> >>	// Define Pattern1
> >>	Pdefn //(key,Pattern)
> >>	(
> >>		\Pattern1,
> >>		{
> >>			arg e;
> >>			Pbind
> >>			(
> >>				\instrument, e.instrument,
> >>				\midinote, Pfunc { e.midinote },
> >>				\dur, e.dur,
> >>				\legato, e.legato,		//
> >>/legato is a common synth parameter (find out
> >>others)
> >>				\amp, e.amp,
> >>				\detune, e.detune
> >>			)
> >>		}
> >>	);
> >>)
> >>
> >>I then change only one midinote in the sequence as follows:
> >>
> >>Pdefn(\Pattern1).set(\midinote, Pseq([36, 37, 38, 39, 51, 41, 42, 43, 44,
> >>45, 46, 47, 48, 49, 50, 51], inf).asStream);
> >>
> >>This however, resets the pattern.  How can I change one element of the
> >>original Pseq whilst leaving the rest of the notes to play as per the
> >>original Pseq?
> >>
> >>Can I also change multiple elements at a time, still leaving those
>
> elements
>
> >>that are unchanged in place?
> >
> > you may want to try:
> > Pdefn(\Pattern1).event.place(\midinote, Pseq([36, 37, 38, 39, 51, 41,
> > 42, 43, 44, 45, 46, 47, 48, 49, 50, 51], inf));
> >
> > (here you need to do this for each key you wish to change, can be at
> > the same time, but I forgot to implement key value pairs like in
> > "set").
> >
> > the second time you do it, it should be updating immediately.
> >
> > Also have a look at Pbindef, maybe that helps you, too. The dewdrop
> > lib(see quark) provides also further possibilities along these lines.

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/