Forums > MaxMSP

Logarithmic dials

October 2, 2009 | 12:50 pm

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,


October 2, 2009 | 1:59 pm

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.


October 2, 2009 | 2:06 pm

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.


October 2, 2009 | 2:59 pm

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


October 2, 2009 | 3:04 pm

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?


October 2, 2009 | 3:10 pm

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?


October 2, 2009 | 3:16 pm

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


October 2, 2009 | 4:11 pm

no worries Smile


October 2, 2009 | 5:44 pm

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. –

Viewing 9 posts - 1 through 9 (of 9 total)