# Chains of reassignment

Can someone explain to me exactly what is going on
A variable is assigned to sig
First sig is a sineOsc frequency modulated by an Lfo
The second sig is a new sinosc whose phase is modulated by sig , I assume this ‘sig’ is the first sine osc
Then the third sig is a new SinOsc whose phase is also modulated , but modulated by which sine osc , the first , the second ?
Or does it always takes the prevous signal , iow serial chaining ?
Sadly there is no way to mute individual lines to get to the bottom of this ( without the interpreter giving error messages )

It seems to be serial but not sure

(
{
var sig;
sig = SinOsc.ar(LFNoise0.kr(10).exprange(1, 1000));
sig = SinOsc.ar(310, sig * 3);
sig = SinOsc.ar(230, sig * 0.4);
sig * 0.2
}.play
)

O.k. It’s serial ,
I narrowed it down , using simple phase modulation
First example is done using reassignment

(
{
var sig;
sig = SinOsc.ar(20,mul:10);
sig = SinOsc.ar(200,sig);
sig = SinOsc.ar(300,sig);
sig * 0.2
}.play)

And the second one just using nested u-gens

({SinOsc.ar(300,SinOsc.ar(200,SinOsc.ar(20,mul:10)))*0.2}.play)

You could actually learn something quite important from this point.

There is, of course, a way to do it – but “muting individual lines” is not conceptually rich enough to get you to the answer.

Taking just two steps in the chain, for example:

``````var sig;
sig = SinOsc.ar(LFNoise0.kr(10).exprange(1, 1000));
sig = SinOsc.ar(310, sig * 3);
``````

A UGen’s output depends on its inputs.

`SinOsc.ar(310, sig * 3)` depends on its frequency (310) and its phase (sig * 3). This multiplication in turn depends on `sig` and 3. `sig` was assigned in the previous line, so all the dependencies are met.

What if you comment out the first `sig = ...`?

What is `sig` in this case?

The value of a variable that hasn’t been assigned anything is `nil`.

So the phase input becomes `nil * 3`.

What should one expect the result of this operation to be?

It’s a nonsense operation. You can’t do multiplication with only one number. So it produces an error. (Here… You said “without the interpreter giving error messages” without the content of the errors – but errors are not just an inconvenience to be sidestepped – they give you useful information about what went wrong! Dig into that a bit more.)

So then the answer is – to “mute a line,” don’t just delete it. Replace the UGen with another value that makes sense for the input. Often that will be 0 or 1.

``````var sig;
sig = 0; // SinOsc.ar(LFNoise0.kr(10).exprange(1, 1000));
sig = SinOsc.ar(310, sig * 3);
``````

When you delete a patch cable in VCV or Reaktor, this isn’t “no value” for the input – the input takes a neutral value. Likewise in SC, there needs to be a neutral value. “No input” is likely to cause a problem. Neutral values will work. (Most UGens have default values, so `SinOsc.ar` actually works even with “no” frequency – because there’s nothing overriding the default frequency. But `SinOsc.ar(nil)` – explicitly requesting no value – gives you “ERROR: SinOsc arg: ‘freq’ has bad input: nil”.)

hjh

Also: In your code examples, you’re using quotation markup, which is not the same as code markup.

You should be posting code like this:

`````````