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

Re: [sc-users] SynthDescLib and Pbind



I believe the NodeSnapshot quark can do what you're looking for.

(
g = Group();

Pbind(
\instrument, \default,
\group, g
).play;

fork {
inf.do {
TreeSnapshot.get({
|tree|
tree.postln;
}, g);
2.wait;
}
};
)

This is intended for debugging and occasional use - it's a pretty heavy-weight way of getting the parameters of a running synth, so if you're planning on calling it to get realtime status of your synth argument values, I would definitely try something else.

- S

On Sat, Dec 15, 2018 at 4:18 PM <sam@xxxxxxxxxxx> wrote:
hi daniel,

I'm not really interested in the default values. what I want is to asynchronously take snapshots of the events values as they unfold. so far I'm using this function that I believe you shared with the list a while ago:

var get_control_values = { |synth|
    var event = ();
    var desc = SynthDescLib.global[synth.defName.asSymbol];

        desc.notNil.if {
        desc.controls.do {
            |ctl|
            if( ctl.name != '?', {
            if( ctl.numChannels > 1, {
                       synth.getn(ctl.name, ctl.numChannels,  {
                |v|

                event.put(ctl.name, v)
            })
            },
            {
              synth.get(ctl.name,  {
                |v|
                event.put(ctl.name, v)
                } );
            });
            } );
        };
    };
    event;
};

a = Synth(\default);
b = get_control_values.(a)
b.postln;

now with Pbind I know the SynthDef's name but I don't know how to obtain a
handle to the Synth.

thanks a lot for helping out.

::: sam :::

On Sun, 16 Dec 2018 00:28:51 +0100 sc-users@xxxxxxxxxxxxxxxx said

> Hi,
>
> if you're not setting with Pbind there will be the default args and you can
> get them like this:
>
> SynthDescLib.global[\default].controlDict.collect(_.defaultValue)
>
> // equivalent
>
> SynthDescLib.global[\default].controlDict.collect { |x| x.defaultValue }
>
> // or
>
> SynthDescLib.global[\default].controls.collect { |x| x.name -> x.defaultValue
> }
>
> So there's no need to track the synths (except you're somehow controlling
> them otherwise)
>
> Regards
>
> Daniel
>
> -----------------------------
> http://daniel-mayer.at [5]
> -----------------------------

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.birmingham.ac.uk/facilities/ea-studios/research/supercollider/mailinglist.aspx
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/