Attenuator - best practices?

Hello! Most of my modules have: A knob, CV input, and attenuator (0.0 to 1.0). In this case…

final_value = knob + (attenuator * CV input)

I’m working on a module that will have only a knob and a CV input. What’s works best for this setup?

  • final_value = knob * cv_input
  • final_value = knob + cv_input

?

I know that this is a super newbie question, so please bear with me! Thanks!!

I would go for: final_value = knob + cv_input

but final_value should not go beyond it’s min or max values

second this - knob + cv_input and then clamped.

I would also recommend on your modules with attenuators to have the range go from -1 to 1 (becoming attenuverters) for added flexibility

1 Like

Maybe output = input * attenuation.

e.g.

Input Attenuator / Attenuverter Value Output
0.0 0.0 0.0
10.0 0.0 0.0
10.0 1.0 10.0
-10.0 1.0 -10.0
-10.0 -1.0 10.0

Something like…

voltage = inputs[INPUT_VOLTAGE_PORT].getVoltage() * params[KNOB].getValue();

Also maybe have a look at the clamp(), clampSafe() and rescale() functions in Rack/include/math.hpp as they can help ensure the output value is clamped, etc., as @Ahornberg and @almostEric have said.

1 Like

Thanks so much for your replies! I really appreciate it!

1 Like

For me, I think the choice likely depends on what the knob does, and whether that lends itself more to being offset or attenuated.

So… What does the knob do?

Also… Given that your knobs typically have both CV and attenuation, how come only one input for this one?