## Logarithmic dials

Oct 2, 2009 at 12:50pm

# Logarithmic dials

I’m looking to make my dial objects operate in a logarithmic manner, similar to the knobs in Ableton Live. Anyone have any tips on making this happen?

Cheers,

#45702
Oct 2, 2009 at 1:59pm

Dials and sliders are linear, but nothing stops you from putting any arbitrary mapping/scaling/exponentiation/whatever after the dial before the value goes to the rest of your patch.

#164801
Oct 2, 2009 at 2:06pm

Yes, I understand that. What is the best method of scaling logarithmically? I have trouble because I want to use [scale] but it doesn’t really handle logarithmic scaling very well. Does anyone know how Ableton scales stuff? Like for example a knob will start at 10ms, 50% is 100ms, 75% is 400ms, 100% is 1000ms… Logarithmic/exponential maths, not my strong point.

#164802
Oct 2, 2009 at 2:59pm

you could use the [pow] object, it raises the input to a power of its argument, or its right input.

#164803
Oct 2, 2009 at 3:04pm

I don’t understand how the [pow] object would help me to scale a range (e.g. 0-127) logarithmically rather than linearly. Could you please elaborate?

#164804
Oct 2, 2009 at 3:10pm

if you set the knob to range from 0 – 100 (for simplicities sake) and have the argument as [pow 1.5], you will be able to gain a range of 0-1000.

when the knob is 25% the value out will be 125, 50% value out is 353, 75% is 649 and of course, all the way up will return 1000.

i know its not exactly what you wanted (with nice round numbers at the quartiles), but it is scaled in a non linear range.

something you might want to take note of though, is that the numbers coming out of [pow] will increase in jumps, as its control increases in values of one, the difference is greater than one on the output.. you might want to use a [line] to smooth out the data coming out so theres no big jumps, depending on what your application is. anybody got a better method?

#164805
Oct 2, 2009 at 3:16pm

Oh yes, I see, and from there I can just use [scale] as I normally would. Thanks!

#164806
Oct 2, 2009 at 4:11pm

no worries

#164807
Oct 2, 2009 at 5:44pm

Try this, it might give some ideas for making curves that will do what you need. Lots more possibilities with [expr] of course… this is a simple one, but gets some more mileage from inverting the values in several ways, check the screenshot.

These are also good curves for dealing with linear-to-log-style controls, like if you want to use a regular slider to control a gain~… just mapping the values straight to the gain doesn’t work well, you need some kind of r-shaped curve for it to feel right—that is, to make the range respond the way you’d expect on a mixer or similar.

I generally use sliders to control my gains~ so I can restrict the output values to unity dB (127), unless I want the extra boost above that… but usually I want to know that the max value isn’t adding any extra signal to the original.

– Pasted Max Patch, click to expand. –
#164808

You must be logged in to reply to this topic.