# Function 1/x

I am trying to think of a way to perform the function 1/x on a signal.

So if a value of 0.5 goes into the chain, 2 comes out. Or 0.3333 in outputs a ~3.

Any ideas how to construct such a chain?

Weird, this should be super easy, but itâ€™s obviously not!

Is subtraction possible?

If so then you can count the number of times you need to subtract the incoming value before you reach 0.

``````1 - 0.5 = count 1
0.5 - 0.5 = count 2
``````

Seems really inefficient though and I am not even sure it is possible. I canâ€™t think of any other way of doing it.

Interesting idea but not sure it would meet my needs. Currently trying to create a LUT for use in a sample scanner as @Starthief described in another post. I think that might work but I was hoping to do it more â€śnativelyâ€ť.

Yeah, that could work, though not exactly cpu friendly for such a simple operation

I think @odevices is the only one who can remedy this in a sensible way; I would love to hear of any other ideas though.

I have the feeling we are pretty much out there on our own with these things at the momentâ€¦

Has anyone else written anything in the middle layer? We would love to hear from you

I have nothing useful to add but I would second the request for more native logic / math ops.

2 Likes

yes, thatâ€™s what i was asking for in my â€ślow level unitsâ€ť thread.
an efficient way to do simple math and\or trigonometry on signals.
i can now do multiplication, addition, division by integers (rational vca), power^, i think subtraction if we keep a signal, put it in a mixer channel and put a bipolar vca with -1 as gain, but not really sure if that is correctâ€¦

The sample scanner with a transfer function crafted in a spreadsheet â†’ Audacity worked.

I ended up with abs(1/x)/1000 for 2001 values ranging from -1.000 to 1.000. Zero had to be hand-set, obviously. Then in the 301 it has to go out to a VCA, gain = 1000.

3 Likes

Wait. The rational VCA should be able to do this, shouldnâ€™t it.

EDIT: Looks like it canâ€™t, if the divisor is fractional. Thought I might be able to edit the control (which you can) but the result seems to indicate that internally itâ€™s still using a divisor of 1 for fractional values.

i did not test it like you did but i was guessing it behaved like that given that its intended use is to do perfect, integer div\mult.
maybe @odevices can make us a frac\float version?
or is it something you can try to hack in lua @Joe?

also: iâ€™m not in front of my rig now, but is the div modulatable? i mean, we can route a signal to it?

You can modulate the denominator but it appears to only process integers.

Thereâ€™s no divide object in the middle layer that I have found, so my next â€śhackâ€ť was going to be to use the sample scanner as a transfer function in the middle layer. To achieve the 1/x function needed for a unit Iâ€™ve been working on.

1 Like

yeah, given the course my units have taken that would be handy for me as well!

What is this for?

well, in my case it would be a very useful tool to implement formulas or expressions i can use on the signal

Hehe. That is a given. I was hoping for a more specific example.

Itâ€™s a secret a the moment, perhaps @Joe will tell you in a PM, but I warn you itâ€™s a head wrangler

To avoid being too specific until Iâ€™m ready, Iâ€™ll be very specific. I need it to set a gain block on a signal into Slew Limiterâ€™s time parameter.

1 Like

After working through this, by the way, I can see why there is no divide type function outside of what you can do with the rational VCA. In a system like this you would encounter trying to divide by zero all over the place, so a bit of a trap.

I think using the sample scanner with a hand made transfer function will work for my purposes here.

3 Likes

Automatic gain control (AGC)?

1 Like

Yes, a feedback control system.

1 Like

Are bitshift and bitwise math operators available? Binary division can by performed using a â€śshift and subtractâ€ť method.

2 Likes