Yes, you could put them in the same parentheses if you wish to be more explicit, but it's not necessary. You can perform additions in any order and it will always be the same result.

On Sun, Dec 15, 2019, 11:10 AM <nilswallgren@xxxxxxxxxxx> wrote:

Thanks for the reply and sorry that I missed it and not answering earlier. Very good information, have had a bit of trouble getting my head around but

this “SomeUgen.ar(freq, mul, add) == SomeUgen.ar(freq).range(-mul, mul) + add” is really helpful. I will put it in my notebook.

This logic makes the LFSaw.ar([5, 5.123]).bipolar(3) + 80 the add argument of LFNoise1.ar, right? But shouldn’t the LFSaw.ar and  + 80 be in the same parentheses like this:

LFNoise1.ar(1).bipolar(24)) + ( LFSaw.ar([5, 5.123]).biipolar(3) + 80)

It may yield the same result...

Sent from Mail for Windows 10

From: brettpilch1983@xxxxxxxxx
Sent: Friday, 13 December 2019 23:19
To: sc-users@xxxxxxxxxxxxxxxx

Since there are 2 nested UGens both with muls and adds, I don't know of a way to do it with a single call to range, but here is a version with 2 calls to range that produces the same result as the SC book example:

(

play(

{

CombN.ar(

SinOsc.ar(

midicps(

LFNoise1.ar(1).range(-24, 24) +  LFSaw.ar([5, 5.123]).range(-3, 3) + 80

),

0, 0.1),

1, 0.1, 2,0.5)

}

)

As a general rule, you can follow this algorithm:

If the Ugens are nested like in your example, you can still follow the same algorithm, working from the inside out. Also note that you can use the bipolar method instead of range any time the range is symmetrical around 0. For example:

bipolar(3) == range(-3, 3)

bipolar is more concise, and I find it more readable, but it depends on your preference of course. I hope that helps.

--Brett

On Fri, Dec 13, 2019 at 1:35 PM <nilswallgren@xxxxxxxxxxx> wrote:

I am trying to convert this example from the SC Book to .range instead of mul and add but I am having some trouble doing it.

This is the original:

(

play(

{

CombN.ar(

SinOsc.ar(

midicps(

LFNoise1.ar(1, 24,

LFSaw.ar([5, 5.123], 0, 3, 80)

)

),

0, 0.1),

1, 0.1, 2,0.5)

}

)

)

// my first attempt

(

play(

{

CombN.ar(

SinOsc.ar(

midicps(

LFNoise1.ar(1+LFSaw.ar([5,5.123])).range(27,104)

),

0, 0.1),

1, 0.1, 2,0.5)

}

)

)

//#2

(

play(

{

CombN.ar(

SinOsc.ar(

midicps(

LFNoise1.ar(10,3*LFSaw.ar([5,5.123])).range(27,104)

),

0, 0.05),

1, 0.1, 2,0.5)

}

)

)

//#3

(

play(

{

CombN.ar(

SinOsc.ar(

midicps(

LFNoise1.ar(10,3)*LFSaw.ar([5,5.123]).range(27,104)

),

0, 0.05),

1, 0.1, 2,0.5)

}

)

)

Sent from Mail for Windows 10