Questions regarding Pspawner

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Questions regarding Pspawner

mousaique
Hello all,
i have three questions, only related by the fact them all concerning Pspawner:)

1.Can the wait arg be dynamically controlled, e.g. through Patterns?
2.Can sequential or parallel subpatterns in a Pspawner share data, like Pkey does inside a Pbind?
3.Is it possible to "realtime" update a Pspawner while playing, like e.g. with a Pbindef?

Hope its ok to bundle the questions like this.
Many thanks,
j

Reply | Threaded
Open this post in threaded view
|

Re: Questions regarding Pspawner

daniel-mayer
Hi,

I'll answer inline

Am 07.01.2018 um 11:23 schrieb [hidden email]:

> Hello all,
> i have three questions, only related by the fact them all concerning Pspawner:)
>
> 1.Can the wait arg be dynamically controlled, e.g. through Patterns?

Yes, you just have to define it, i.e. make a Stream and poll from it

(
Pspawner({ |sp|
        var w = Pseq([0.2, 0.6], inf).asStream;
        10.do {
                sp.seq(Pbind(\note, Pwhite(-10, 20, 4), \dur, 0.15));
    sp.wait(w.next);
        }
}).play
)
       

> 2.Can sequential or parallel subpatterns in a Pspawner share data, like Pkey does inside a Pbind?


Yes, they can share data with the same strategies that work in general, e.g. define local variables

(
p = Pspawner({ |sp|
        var chord;
        sp.par(
                Pbind(
                        \setChord, Pseq([0, 4.5, 8, 2.5], inf).collect { |x| chord = [0, 4, 7] + x },
                        \dur, 1.5,
                        \type, \rest
                )
        );
        sp.wait(0.001); // ensure harmony choice before melody
        sp.par(Pbind(\note, Pfunc { chord.choose }, \dur, 0.2, \octave, Pwhite(4, 5)));
        sp.par(Pbind(\note, Pfunc { chord.choose }, \dur, 0.1, \octave, Pwhite(6, 7)));
}).play
)

p.stop


> 3.Is it possible to "realtime" update a Pspawner while playing, like e.g. with a Pbindef?


Sure, e.g. with setting envir variables (dynamic scoping).
Here a combination of topics (2) and (3)

(
~chord = [0, 4, 7];
p = Pspawner({ |sp|
        sp.par(Pbind(\note, Pfunc { ~chord.choose }, \dur, 0.2, \octave, Pwhite(4, 5)));
        sp.par(Pbind(\note, Pfunc { ~chord.choose }, \dur, 0.1, \octave, Pwhite(6, 7)));
}).play
)

~chord = [0, 3, 11]

~chord = [-6, 2, 10]

~chord = [0, 2.5, 7, 9.5]

p.stop



That's the same principle as with Pspawner and VarGui control, that came up in some other threads, e.g.

http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Spreading-arrays-list-values-throughout-events-td7632624.html



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
|

Re: Questions regarding Pspawner

mousaique
as always, thank you daniel for the thorough answer!

On Sun, Jan 7, 2018 at 3:02 PM, <[hidden email]> wrote:
Hi,

I'll answer inline

Am 07.01.2018 um 11:23 schrieb [hidden email]:

> Hello all,
> i have three questions, only related by the fact them all concerning Pspawner:)
>
> 1.Can the wait arg be dynamically controlled, e.g. through Patterns?

Yes, you just have to define it, i.e. make a Stream and poll from it

(
Pspawner({ |sp|
        var w = Pseq([0.2, 0.6], inf).asStream;
        10.do {
                sp.seq(Pbind(\note, Pwhite(-10, 20, 4), \dur, 0.15));
                sp.wait(w.next);
        }
}).play
)


> 2.Can sequential or parallel subpatterns in a Pspawner share data, like Pkey does inside a Pbind?


Yes, they can share data with the same strategies that work in general, e.g. define local variables

(
p = Pspawner({ |sp|
        var chord;
        sp.par(
                Pbind(
                        \setChord, Pseq([0, 4.5, 8, 2.5], inf).collect { |x| chord = [0, 4, 7] + x },
                        \dur, 1.5,
                        \type, \rest
                )
        );
        sp.wait(0.001); // ensure harmony choice before melody
        sp.par(Pbind(\note, Pfunc { chord.choose }, \dur, 0.2, \octave, Pwhite(4, 5)));
        sp.par(Pbind(\note, Pfunc { chord.choose }, \dur, 0.1, \octave, Pwhite(6, 7)));
}).play
)

p.stop


> 3.Is it possible to "realtime" update a Pspawner while playing, like e.g. with a Pbindef?


Sure, e.g. with setting envir variables (dynamic scoping).
Here a combination of topics (2) and (3)

(
~chord = [0, 4, 7];
p = Pspawner({ |sp|
        sp.par(Pbind(\note, Pfunc { ~chord.choose }, \dur, 0.2, \octave, Pwhite(4, 5)));
        sp.par(Pbind(\note, Pfunc { ~chord.choose }, \dur, 0.1, \octave, Pwhite(6, 7)));
}).play
)

~chord = [0, 3, 11]

~chord = [-6, 2, 10]

~chord = [0, 2.5, 7, 9.5]

p.stop



That's the same principle as with Pspawner and VarGui control, that came up in some other threads, e.g.

http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/Spreading-arrays-list-values-throughout-events-td7632624.html



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/