## How to scale oscillator signal to control amp via float values 0 to 1

Apr 30, 2012 at 5:09pm

# How to scale oscillator signal to control amp via float values 0 to 1

I have scaled a [phasor~] to output float values between -1 and 1, to control an amplifier, depending on waveform cycles. I have used the following abstraction to do this.

[phasor~ 0.5]
[cos~]
[*~]
[snapshot~ 10]
[+ 1.]
[/2.]

If the amplifier between [phasor~] and [snapshot] is turned down it is represented in the float output, however, when it is turned down completely it always outputs [05] – as 0 + 1 /2 = 0.5. I would like to determine a way whereby when the [*~] is turned down to zero it outputs a float value of 1.

I have included a patch where this is outlined more clearly.

– Pasted Max Patch, click to expand. –
#63314
Apr 30, 2012 at 5:16pm

edit

laters

#228371
Apr 30, 2012 at 5:21pm

I require the final output to be between 0 and 1 – as I am planning on controlling an [*~]

#228372
Apr 30, 2012 at 5:39pm

The problem lies in the fact you are scaling a sinusoid, whose minimum amplitude will always lie in the centre of any range……the best I could manage was this “cheat”, which isn’t ideal, as any offset will mess up the desired output range; these are just facts sadly,

– Pasted Max Patch, click to expand. –

Brendan

edit: just looked at this again and, given the stated problem, it ain’t that bad you know :)

#228373
Apr 30, 2012 at 6:37pm

Thanks for the help! I just solved the issue myself after getting some inspiration from your patch I made it so that 0.5 is added to the float outputting the phasor cycle – as the float controlling the phasor’s amplitude is increased the amount added is gradually decreased to 0. Totally avoided anything to do with the signal. I sear I don’t fully understand what is going on, partly because the patch I am working on is quite messy, but it seems to work fine.

#228374
Apr 30, 2012 at 6:39pm

Here’s a screenshot. djf_sliderscope] takes a signal and outputs 0 to 127 for its waveform.

###### Attachments:
#228375

You must be logged in to reply to this topic.