'setn' not recognizing symbols or strings

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

'setn' not recognizing symbols or strings

Chris Brown
This might be very old news (same behavior in SC7.1 and SC 9.0), but this example from the Node
help-file works correctly  only with indices,
not with symbols or strings -- that is, with symbols or strings only the first value in a list is set,
but with integer-indices all are.  

This (direct copy from helpfile) DOES NOT work:

x = SynthDef("help-node-setn", {
    arg freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05, amp3 = 0.05;
    Out.ar(0, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2, amp3])));}).play(s);
)
// set 3 controls starting from \freq1, and 3 controls starting from \amp1
x.setn(\freq1, [440, 880, 441], \amp1, [0.3, 0.1, 0.3]);

This DOES:

(
x = SynthDef("help-node-setn", {
    arg freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05, amp3 = 0.05;
    Out.ar(0, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2, amp3])));}).play(s);
)
// set 3 controls starting from \freq1, and 3 controls starting from \amp1
x.setn(0,  [440, 880, 441], 3, [0.3, 0.1, 0.3]);

Chris

Chris Brown
Professor of Music
Mills College, Oakland, CA
www.cbmuse.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/
Reply | Threaded
Open this post in threaded view
|

Re: 'setn' not recognizing symbols or strings

ddw_music
Chris Brown wrote

> This might be very old news (same behavior in SC7.1 and SC 9.0), but this
> example from the Node help-file works correctly only with indices, not
> with symbols or strings -- that is, with symbols or strings only the first
> value in a list is set, but with integer-indices all are.  
>
> This (direct copy from helpfile) DOES NOT work:
>
> x = SynthDef("help-node-setn", {
>     arg freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05,
> amp3 = 0.05;
>     Out.ar(0, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2,
> amp3])));}).play(s);
> )
> // set 3 controls starting from \freq1, and 3 controls starting from \amp1
> x.setn(\freq1, [440, 880, 441], \amp1, [0.3, 0.1, 0.3]);

Yes, this was changed awhile back so that \freq1 is considered to be a
single-channel control input -- so, setting it to an array is considered to
be an overflow.

The help example needs to be deleted or rewritten.

hjh



--
Sent from: http://new-supercollider-mailing-lists-forums-use-these.2681727.n2.nabble.com/SuperCollider-Users-New-Use-this-f2676391.html

_______________________________________________
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: 'setn' not recognizing symbols or strings

julian.rohrhuber
In reply to this post by Chris Brown
Nowadays I’d tend to write this as


var freqs = \freqs.kr(440 ! 3);

or

var freqs = NamedControl.kr(\freqs, 440 ! 3);



> On 11.02.2018, at 21:28, Chris Brown <[hidden email]> wrote:
>
> This might be very old news (same behavior in SC7.1 and SC 9.0), but this example from the Node
> help-file works correctly  only with indices,
> not with symbols or strings -- that is, with symbols or strings only the first value in a list is set,
> but with integer-indices all are.
>
> This (direct copy from helpfile) DOES NOT work:
>
> x = SynthDef("help-node-setn", {
>    arg freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05, amp3 = 0.05;
>    Out.ar(0, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2, amp3])));}).play(s);
> )
> // set 3 controls starting from \freq1, and 3 controls starting from \amp1
> x.setn(\freq1, [440, 880, 441], \amp1, [0.3, 0.1, 0.3]);
>
> This DOES:
>
> (
> x = SynthDef("help-node-setn", {
>    arg freq1 = 440, freq2 = 440, freq3 = 440, amp1 = 0.05, amp2 = 0.05, amp3 = 0.05;
>    Out.ar(0, Mix(SinOsc.ar([freq1, freq2, freq3], 0, [amp1, amp2, amp3])));}).play(s);
> )
> // set 3 controls starting from \freq1, and 3 controls starting from \amp1
> x.setn(0,  [440, 880, 441], 3, [0.3, 0.1, 0.3]);
>
> Chris
>
> Chris Brown
> Professor of Music
> Mills College, Oakland, CA
> www.cbmuse.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/


signature.asc (849 bytes) Download Attachment