# Custo Unit controls - some questions

hello there.
i’d like to know if there’s a way to have unipolar controls on custom units.
example:
i want to control a filter Q parameter, i want to have a custom unit control that fully closes the Q when at the extreme bottom and fully open it when at the extreme top.
i turn the filter q bias all the way down, turn the custom control all the way up and apply gain to filter q until i see it reaching maximum value.
but then if i turn down the custom control i realize that it still closes the q at 0 (midway position) then ignores the negative values.
then i tried giving the Q an initial bias so it is at centre position and still no way.

please @odevices can you give me an example of how to set custom controls for cutoff frequency and Q on a filter?
thank you very much in advance.

1 Like

ok i figured out the maths for the Q parameter.

what i can’t grasp is frequency control for the filter. it seems the upper part of the slider behaves linear the lower part log or expo. i mean, i try empirically and add an external cv to the custom unit filter frequency custom control, adjust the gain and bias of the control so i can sweep his entire range, then go into the ladder lpf and try to adjust gain and bias for filter frequency (modulated by the custom control). i can regularly sweep the upper portion of the slider but as soon as i reach center position and try to go downward it jumps like exponentially down… what am i not grasping?

1 Like

OK i think i got it, and i feel very stupid
i was getting confused by the FADER position and forgot to think in numbers
obviously i have to put the bias at the REAL half way, about 7000 hz then it behaves as it should
sorry for the fuss but maybe this could be helpful to other people as well

still i have a question: is it smart to have a linear control over something basically exponential like frequency? but…if i put a pitch control it doesn’t have gain, only an offset…

how you people solve this problem?

1 Like

bump!

I think linear is the choice for now unless you want to venture into the middle layer.

FYI, every fader control has quite a few things going on inside it. The components that influence how the encoder changes its value and subsequently how the value is displayed graphically are:

• a fully-customizable lookup table which maps encoder phase to an actual value.
• should the lookup table be interpolated or not?
• phase increments for SUPER FINE, FINE, COARSE, and SUPER COARSE.
• a scaling rule that maps fader value to the actual graphical position (i.e. usually linear vs octaves).
• a unit of measurement (dB, Hz, sec, cents, etc.) for the numeric readouts.

For your enjoyment here is how the frequency faders for oscillators are defined. First, the function that is used to define the entries in the fader’s lookup table.

``````local function octaveMapWithZero(from,to,F0,step)
local map = app.DialMap()
local n = 0
for x=from,to,step do n = n + 1 end
map:clear(n+1)
for x=from,to,step do
end
map:setZero(0,false)
return map
end

dialMaps["oscFreq"] = octaveMapWithZero(-10,10,27.5,1.0/12)
``````

In English,

``````Create an entry, every semitone, 10 octaves above and 10 octaves below 27.5Hz.  Finally, add zero to the beginning.
``````

Here is the definition for the f0 control for a Sine Oscillator unit that uses the above lookup table for its fader control:

``````  controls.freq = GainBias {
button = "f0",
description = "Fundamental",
branch = self:getBranch("Fundamental"),
gainbias = objects.f0,
range = objects.f0Range,
biasMap = Encoder.getMap("oscFreq"),
biasUnits = app.unitHertz,
initialBias = 27.5,
gainMap = Encoder.getMap("freqGain"),
scaling = app.octaveScaling
}
``````

Notice that the `biasMap` specifies the encoder lookup table, `biasUnits` specifies the unit of measurement and `scaling` changes the graphical scaling from linear (default) to octaves.

The freq fader of a filter is essentially the same except a zero is not added to the lookup table. The zero is added in the case of oscillators so that you can “freeze” the oscillator.

1 Like