Quantcast

Changing parameters of a running Pattern

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Changing parameters of a running Pattern

thrifleganger
This post has NOT been accepted by the mailing list yet.
Hey there,

I'm pretty new to patterns, and my requirement is as follows:
1) Implement a global adsr envelope on a Pbind.
2) Control the release trigger by setting the gate param of the Pbind.

Here's a simple example:
(
~gate = 1;
p = Pbind(
        \freq, Pseq([60, 62, 64].midicps, inf),
        \tempo, 8,
        \amp, Env.adsr(0.2, 0.2, 0.8, 2),    // This produces only one note or so, why??
        \gate, ~gate                                 // Can I set this value to 0, while the Pbind is running?
);
)

Any other approaches are appreciated.
Cheers,
Akash
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

daniel-mayer
>Hey there,

>I'm pretty new to patterns, and my requirement is as follows:
>1) Implement a global adsr envelope on a Pbind.
>2) Control the release trigger by setting the gate param of the Pbind.

>Here's a simple example:
>(
>~gate = 1;
>p = Pbind(
>        \freq, Pseq([60, 62, 64].midicps, inf),
>       \tempo, 8,
>        \amp, Env.adsr(0.2, 0.2, 0.8, 2),    // This produces only one note or so, why??
>        \gate, ~gate                                 // Can I set this value to 0, while the Pbind is running?
>);
>) 

Hi,

note that you haven't subscribed to the mailing list yet,
so your post is only read by people on nabble.
People subscribed to the list, who are not using nabble, don't see it.


Several points here:

.) setting the tempo from within a Pbind is bad because it sets the default tempo clock, better take a new clock


.) To change a value while the Pbind is running you'd have to write Pfunc { ~val }, and you could write that here too with ~gate,
but you can also use a group and release the group (this will release previous nodes too)

(
t = TempoClock.new(8);

g = Group.new;

p = Pbind(
\freq, Pseq([60, 62, 64].midicps, inf),
\group, g,
\amp, Env.adsr(50, 30, 0.3, 1)  // also affected by tempo  
);

p.play(t)   // play with new TempoClock set to tempo 8

// eval separately

(
p.stop;
t.stop;
)

g.release(3);


Regards

Daniel

-----------------------------
www.daniel-mayer.at
-----------------------------



Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

thrifleganger
Thank you for the response,

I learnt quite a bit here. But I've still got a couple of issues,

p = Pbind(
        \freq, Pseq([60, 62, 64].midicps, inf),
        \group, g,
        \amp, Env.adsr(50, 30, 0.3, 30)  // also affected by tempo  
);


Here, the adsr envelope behaves as regular envelope, and doesn't wait for a gate value to trigger the release phase. Why is that?

Regards,
Akash
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

Kuivila, Ronald
Hi Akash,

The short answer is that gates, etc are attributes of EnvGen, not Env.
Normally, an Env is used to specify the envelope an EnvGen UGen creates.  
That is something that runs on the server.


The longer story is

In this case, the Env is being treated as a "Pattern" (like Pseq).
As a stream, Env returns values based on the timing of the pattern as a function of time.  One could define a PenvGen
to read the Env and do gate, releaseNode, loopNode, etc but no one has done so.

RJK

note: A Pattern specifies a Stream and creates it in response to the methods "asStream" and "embedInStream".
So, one pattern can create arbitrarily many identically specified streams.
Streams are objects that return a series of value in response to 'next'.

> On May 16, 2017, at 4:13 AM, [hidden email] wrote:
>
> Thank you for the response,
>
> I learnt quite a bit here. But I've still got a couple of issues,
>
> p = Pbind(
> \freq, Pseq([60, 62, 64].midicps, inf),
> \group, g,
> \amp, Env.adsr(50, 30, 0.3, 30)  // also affected by tempo  
> );
>
>
> Here, the adsr envelope behaves as regular envelope, and doesn't wait for a
> gate value to trigger the release phase. Why is that?
>
> Regards,
> Akash
>
>
>
> --
> View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Changing-parameters-of-a-running-Pattern-tp7632400p7632408.html
> Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

thrifleganger
Thanks Ronald,

But is there a work around it? Seems like a simple enough requirement, to set a global adsr envelope to a Pbind.

Akash.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

Kuivila, Ronald
Is the idea you want to apply the envelope to the audio output of a free running Pbind?
If so, you could do that on the server easily enough.  Play the Pbind audio on its own bus with an envelope
applied before transferring to the main bus.

NodeProxy would provide a particularly framework for that:

~np = NodeProxy.audio(s, 2).play;

~np[0] = pat;

~np[100] = \filter -> { | audio, egate =1 | EnvGen.kr(Env.adsr, gate) * audio };


Cheers,

RJK


> On May 16, 2017, at 7:59 AM, [hidden email] wrote:
>
> Thanks Ronald,
>
> But is there a work around it? Seems like a simple enough requirement, to
> set a global adsr envelope to a Pbind.
>
> Akash.
>
>
>
>
>
> --
> View this message in context: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Changing-parameters-of-a-running-Pattern-tp7632400p7632410.html
> Sent from the SuperCollider Users New (Use this!!!!) mailing list archive at Nabble.com.
>
> _______________________________________________
> sc-users mailing list
>
> info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
> archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
> search: http://www.listarc.bham.ac.uk/lists/sc-users/search/


_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: http://www.listarc.bham.ac.uk/marchives/sc-users/
search: http://www.listarc.bham.ac.uk/lists/sc-users/search/
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

ddw_music
In reply to this post by thrifleganger
thrifleganger wrote
But is there a work around it? Seems like a simple enough requirement, to set a global adsr envelope to a Pbind.
It has two parts.

1. You need to use a SynthDef that accepts an Env as input. The default SynthDef does not. So you will need to learn how to write a SynthDef if you don't already know it, and then apply this to it... well, it's in the help, but I can't reach the online help files right now. Anyway it looks something like this:

SynthDef(\demo, { | gate = 1, ... other args ... |
    var env = NamedControl.kr(\env, Env.adsr(...).asArray),
    eg = EnvGen.kr(env, gate, doneAction: 2);
    ... blah blah...
}).add;

That should handle any adsr. If you need more envelope nodes, add ".extend(n, 0)" after .asArray -- n should be a multiple of 4.

2. In the Pbind, write [Env(...)] with square brackets instead. The container array protects the Env from being made into a stream.

hjh
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Changing parameters of a running Pattern

ddw_music
ddw_music wrote
It has two parts.

1. You need to use a SynthDef that accepts an Env as input...
Oops, I misunderstood "global envelope." I was answering a different question.

Ron's answer is better.

hjh
Loading...