Quantcast

successive unfolding of arrays?

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

successive unfolding of arrays?

Jan Ferreira
hello list,

following the synth example below, i have two related questions i find difficult to answer:
 
1-is it possible to apply the \cluster array in a way that it successively adds to the freq argument instead of immediately playing all the frequencies at once? 
(for this i´d imagine something like the wait method on routines but using pbind and VarGui instead..)
2-could that kind of "scheduled" array be applied to a whole synth on a macroscale so that it executes a succesion of synths via an array? 
(since \dur doesn taccept  arrays there sould be a workaround this?)

i wonder if these things can be resolved using routine and Pbind together, but i dont quite see how the VarGui control could play a role in this...

many thanks for your help!
jan



(
SynthDef(\example, { arg  freq=100, envdur=1, amp=0.1, out=0, cluster=0;
var env= EnvGen.ar(Env.perc(0,envdur),doneAction:2);
var sound= SinOsc.ar(freq*cluster, 0, env);
Out.ar(out,sound*env*amp)
}).add;)


(p =
Pbind(\instrument, \example,
\cluster, Pfunc{Array.fill(20, {arg i; (i*{~arrayctrl}+1)})},
\arrayctrl, Pfunc{~arrayctrl},
\dur, Pfunc{~dur},
\freq, Pfunc{~freq},
) );


(
v = VarGui([
\arrayctrl, [0.01, 10,\exp, 0.001, 1],
\freq, [20, 1000,\exp, 0.001, 1],
\dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: successive unfolding of arrays?

Daniel Mayer

Hi,

the easiest way that comes to my mind is the use of Event's strum key:
I would slightly rewrite the array constructor in Pbind
as in your example the numbers aren't shown with use of trace.


(
p = Pbind(\instrument, \example,
        \arrayctrl, Pfunc { ~arrayctrl },
        \num, Pfunc { ~num },
        \cluster, Pfunc { |ev| { |i| ev[\arrayctrl] * (i+1) } ! ev[\num] },
        \dur, Pfunc { ~dur },
        \strum, Pfunc { ~strum },
        \freq, Pfunc { ~freq },
);

v = VarGui([
        \num, [1, 20, \lin, 1, 10],
        \arrayctrl, [0.01, 10,\exp, 0.001, 1],
        \freq, [20, 1000,\exp, 0.001, 1],
        \strum, [-0.1, 0.1,\lin, 0, 0],
        \dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
)


Another possibility is the use of Event's timingOffset or lag.
Though probably it's impratical to control a large array by gui like here,
just to show the option


(
p = Pbind(\instrument, \example,
        \arrayctrl, Pfunc { ~arrayctrl },
        \num, Pfunc { ~num },
        \cluster, Pfunc { |ev| { |i| ev[\arrayctrl] * (i + 1) } ! ev[\num] },
        \lagBase, Pfunc { ~lagBase },
        \lag, Pfunc { |ev| { |i| ~lag[i] * ev[\lagBase] } ! ev[\num] },
        \dur, Pfunc { ~dur },
        \freq, Pfunc { ~freq },
).trace;

v = VarGui([
        \num, [1, 20, \lin, 1, 10],
        \arrayctrl, [0.01, 10,\exp, 0.001, 1],
        \freq, [20, 1000,\exp, 0.001, 1],
        \lagBase, [0, 1, \lin, 0, 0],
        \lag, { [0, 1,\lin, 0, 0] } ! 20,
        \dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
)


For more complicated scheduling consider Pspawner,
which can also be used with VarGui, its routine function
can simply refer to envir variables.


(
p = Pspawner { |sp|
        loop {
                sp.par(
                        Pbind(\dur, ~dur, \freq, Pseq([~freq, ~freq * rrand(1, 1.5)]))
                );
                ~delta.wait
        }
};

v = VarGui([
        freq: [20, 1000,\exp, 0.001, 200],
        dur: [0, 1, \lin, 0, 0.1],
        delta: [0.1, 1, \lin, 0, 0.5]
], stream: p).gui
)


For experimenting with arrays you could
replace timing arrays while playing.

One way to do that is the use of a PL, as VarGui plays patterns
in separated envirs you'd have to pass the envir where setting happens,
topEnvironment e.g.

(
~lag = 1 ! 10;

p = Pbind(
        \instrument, \example,
        \arrayctrl, Pfunc { ~arrayctrl },
        \num, Pfunc { ~num },
        \cluster, Pfunc { |ev| { |i| ev[\arrayctrl] * (i + 1) } ! ev[\num] },
        \lagBase, Pfunc { ~lagBase },
        \lag, PL(\lag, envir: topEnvironment) * Pkey(\lagBase),
        \dur, Pfunc { ~dur },
        \freq, Pfunc { ~freq },
);

v = VarGui([
        \num, [1, 20, \lin, 1, 10],
        \arrayctrl, [0.01, 10,\exp, 0.001, 1],
        \freq, [20, 1000,\exp, 0.001, 1],
        \lagBase, [0, 1, \lin, 0, 0],
        \dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
)

replace while playing

~lag = (1..20) / 10;

~lag = (1,3..19) ++ (18,16..2) / 10;



Pdefn, Pbindef, PLbindef and Pspawner could also be used that way.

I find it often practical to switch and combine gui and
live coding control, both have its specific merits. What is suited
better for what param turns out while experimenting.

Greetings

Daniel

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





_______________________________________________
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: successive unfolding of arrays?

Jan Ferreira
hi daniel,
many thanks for showing up these possibilities! seems immensely useful to me...
just a short follow up question: in the first example you give with Pspawner it seems to be playing the default synth.

(
p = Pspawner { |sp|
        loop {
                sp.par(
                        Pbind(\dur, ~dur, \freq, Pseq([~freq, ~freq * rrand(1, 1.5)]))
                );
                ~delta.wait
        }
};

v = VarGui([
        freq: [20, 1000,\exp, 0.001, 200],
        dur: [0, 1, \lin, 0, 0.1],
        delta: [0.1, 1, \lin, 0, 0.5]
], stream: p).gui
)

if i try to replace it with my \example one (via \instrument in the pbind), theres no sound. am i missing something here?
thanks again,
jan

On Sat, Feb 11, 2017 at 5:06 PM, Daniel Mayer <[hidden email]> wrote:

Hi,

the easiest way that comes to my mind is the use of Event's strum key:
I would slightly rewrite the array constructor in Pbind
as in your example the numbers aren't shown with use of trace.


(
p = Pbind(\instrument, \example,
        \arrayctrl, Pfunc { ~arrayctrl },
        \num, Pfunc { ~num },
        \cluster, Pfunc { |ev| { |i| ev[\arrayctrl] * (i+1) } ! ev[\num] },
        \dur, Pfunc { ~dur },
        \strum, Pfunc { ~strum },
        \freq, Pfunc { ~freq },
);

v = VarGui([
        \num, [1, 20, \lin, 1, 10],
        \arrayctrl, [0.01, 10,\exp, 0.001, 1],
        \freq, [20, 1000,\exp, 0.001, 1],
        \strum, [-0.1, 0.1,\lin, 0, 0],
        \dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
)


Another possibility is the use of Event's timingOffset or lag.
Though probably it's impratical to control a large array by gui like here,
just to show the option


(
p = Pbind(\instrument, \example,
        \arrayctrl, Pfunc { ~arrayctrl },
        \num, Pfunc { ~num },
        \cluster, Pfunc { |ev| { |i| ev[\arrayctrl] * (i + 1) } ! ev[\num] },
        \lagBase, Pfunc { ~lagBase },
        \lag, Pfunc { |ev| { |i| ~lag[i] * ev[\lagBase] } ! ev[\num] },
        \dur, Pfunc { ~dur },
        \freq, Pfunc { ~freq },
).trace;

v = VarGui([
        \num, [1, 20, \lin, 1, 10],
        \arrayctrl, [0.01, 10,\exp, 0.001, 1],
        \freq, [20, 1000,\exp, 0.001, 1],
        \lagBase, [0, 1, \lin, 0, 0],
        \lag, { [0, 1,\lin, 0, 0] } ! 20,
        \dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
)


For more complicated scheduling consider Pspawner,
which can also be used with VarGui, its routine function
can simply refer to envir variables.


(
p = Pspawner { |sp|
        loop {
                sp.par(
                        Pbind(\dur, ~dur, \freq, Pseq([~freq, ~freq * rrand(1, 1.5)]))
                );
                ~delta.wait
        }
};

v = VarGui([
        freq: [20, 1000,\exp, 0.001, 200],
        dur: [0, 1, \lin, 0, 0.1],
        delta: [0.1, 1, \lin, 0, 0.5]
], stream: p).gui
)


For experimenting with arrays you could
replace timing arrays while playing.

One way to do that is the use of a PL, as VarGui plays patterns
in separated envirs you'd have to pass the envir where setting happens,
topEnvironment e.g.

(
~lag = 1 ! 10;

p = Pbind(
        \instrument, \example,
        \arrayctrl, Pfunc { ~arrayctrl },
        \num, Pfunc { ~num },
        \cluster, Pfunc { |ev| { |i| ev[\arrayctrl] * (i + 1) } ! ev[\num] },
        \lagBase, Pfunc { ~lagBase },
        \lag, PL(\lag, envir: topEnvironment) * Pkey(\lagBase),
        \dur, Pfunc { ~dur },
        \freq, Pfunc { ~freq },
);

v = VarGui([
        \num, [1, 20, \lin, 1, 10],
        \arrayctrl, [0.01, 10,\exp, 0.001, 1],
        \freq, [20, 1000,\exp, 0.001, 1],
        \lagBase, [0, 1, \lin, 0, 0],
        \dur, [0.01, 10,\exp, 0.001, 1],
], stream: p
).gui;
)

replace while playing

~lag = (1..20) / 10;

~lag = (1,3..19) ++ (18,16..2) / 10;



Pdefn, Pbindef, PLbindef and Pspawner could also be used that way.

I find it often practical to switch and combine gui and
live coding control, both have its specific merits. What is suited
better for what param turns out while experimenting.

Greetings

Daniel

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





_______________________________________________
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: successive unfolding of arrays?

Daniel Mayer

Am 11.02.2017 um 17:38 schrieb Jan Ferreira <[hidden email]>:

> if i try to replace it with my \example one (via \instrument in the pbind), theres no sound. am i missing something here?
> thanks again,
> jan


Did you pass the cluster arg ?
With default cluster = 0 we get SinOsc with freq 0.

This works for me:

(
p = Pspawner { |sp|
        loop {
                sp.par(
                        Pbind(
                                \instrument, \example,
                                \cluster, 1,
                                \dur, ~dur,
                                \freq, Pseq([~freq, ~freq * rrand(1, 1.5)])
                        ).trace
                );
                ~delta.wait
        }
};

v = VarGui([
        freq: [20, 1000,\exp, 0.001, 200],
        dur: [0, 1, \lin, 0, 0.1],
        delta: [0.1, 1, \lin, 0, 0.5]
], stream: p).gui
)


In analogy to your initial example,
you would rather pass a pattern as cluster here.

Greetings

Daniel

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


_______________________________________________
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: successive unfolding of arrays?

Jan Ferreira
of course, thats it! i was suppressing the frequency to 0 by not explicitly passing the cluster argument.
thanks a lot daniel,
jan

On Sat, Feb 11, 2017 at 9:30 PM, Daniel Mayer <[hidden email]> wrote:

Am 11.02.2017 um 17:38 schrieb Jan Ferreira <[hidden email]>:

> if i try to replace it with my \example one (via \instrument in the pbind), theres no sound. am i missing something here?
> thanks again,
> jan


Did you pass the cluster arg ?
With default cluster = 0 we get SinOsc with freq 0.

This works for me:

(
p = Pspawner { |sp|
        loop {
                sp.par(
                        Pbind(
                                \instrument, \example,
                                \cluster, 1,
                                \dur, ~dur,
                                \freq, Pseq([~freq, ~freq * rrand(1, 1.5)])
                        ).trace
                );
                ~delta.wait
        }
};

v = VarGui([
        freq: [20, 1000,\exp, 0.001, 200],
        dur: [0, 1, \lin, 0, 0.1],
        delta: [0.1, 1, \lin, 0, 0.5]
], stream: p).gui
)


In analogy to your initial example,
you would rather pass a pattern as cluster here.

Greetings

Daniel

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


_______________________________________________
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/

Loading...