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

Re: [sc-users] array dynamically in synthdef



adc, thanks.  Learning about NDef is my new project for the week.  The
fadetime argument alone is pretty cool.

On Tue, Jul 28, 2009 at 11:12 AM, Andrew C. Smith<acsmith@xxxxxxxxxxxxxx> wrote:
> Yeah, Hjalte's email popped up just as I hit send.  I've got the
> Control help file open right now.  Every time I think something can't
> be done there's probably just a UGen I haven't heard of.
>
> Questions about Control, though: could Control (or NamedControl) be
> used instead of arg in all cases?  It seems that it supports defaults
> and names.  The help file also has uses where a synth is initialized
> using an arg and a Control with no difference between their syntax.
> Thanks again.
>
> Andrew
>
> On Tue, Jul 28, 2009 at 10:48 AM, James Harkins<jamshark70@xxxxxxxxx> wrote:
>> On Tue, Jul 28, 2009 at 10:37 AM, Andrew C. Smith <acsmith@xxxxxxxxxxxxxx>
>> wrote:
>>>
>>> I think that you can't pass arrays as arguments.
>>
>> You can -- see Hjalte's email. For both of the "ok" synthdefs below, you can
>> send the array directly with set or new:
>>
>> a = Synth(\ok, [x: [5, 6, 7, 8]]);
>> a.set(\x, { 10.rand } ! 4);
>>
>> The issue with Perdo's latest try is that an array given as an argument
>> default must be a literal array. That is, this is OK:
>>
>> SynthDef(\ok, { arg x = #[1, 2, 3, 4];
>> ...
>> })
>>
>> But this is not.
>>
>> var default = [0, 1, 2, 3];
>> SynthDef(\no, { arg x = default;
>> ...
>> });
>>
>> And the solution as Hjalte said is to use Control, or (easier syntax)
>> NamedControl by way of Symbol:kr.
>>
>> var default = [0, 1, 2, 3];
>> SynthDef(\alsoOK, {
>>     var    x = \x.kr(default);
>>     ...
>> })
>>
>> hjh
>>
>>
>> --
>> James Harkins /// dewdrop world
>> jamshark70@xxxxxxxxxxxxxxxxx
>> http://www.dewdrop-world.net
>>
>> "Come said the Muse,
>> Sing me a song no poet has yet chanted,
>> Sing me the universal."  -- Whitman
>>
>

_______________________________________________
sc-users mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-users/
search: https://listarc.bham.ac.uk/lists/sc-users/search/