Logarithmic Conversion

Mar 30, 2013 at 8:07pm

Logarithmic Conversion


I’m trying to convert the frequency range 20-20000Hz to 0-50 logarithmically, for frequency based panning but I am struggling to do so.

Can any maths gurus out there give me a hand? I am just new to Max!


Mar 30, 2013 at 10:15pm

not a maths guru but here is a little abstraction i made a while ago. You can initialise the base value of your mapping with an argument.
Just be sure to stay in the 0. to 1. range at the input and the output will also be in that range.
Roman thilenius also posted a (didnt try it but believe so) great collection of number mapping stuff in this thread:


– Pasted Max Patch, click to expand. –
Mar 30, 2013 at 10:29pm

yet another way:
[ftom] -> [scale 0. 127. 0. 50.]

Mar 31, 2013 at 8:23am

or to be more precise:
[ftom] -> [scale 15.486821 174.939407 0. 50.]

Apr 1, 2013 at 5:56am

[expr ((((log10($f1/8.175798)/log10(1.0594633))-$f2)/($f3-$f2))*($f5-$f4))+$f4]

[expr ((((log10($f1/8.175798)/log10(1.0594633))-20)/(20000-20))*(50-0))+0]

[expr ((((log10($f1/8.175798)/log10(1.0594633))-20)/19980)*50)]


Apr 1, 2013 at 11:48pm

Thank you all!

Apr 1, 2013 at 11:55pm

Terry, I don’t mean to be rude but 20000 Hz converted to MIDI is 135 not 174.939.

Going to give Roman’s solution a try. I imagine it will be correct.

Apr 2, 2013 at 3:26am

eh –but hey it is the right midi note for 200,000 hz…. :-)

Apr 2, 2013 at 4:47am

Ultrasonic MIDI for your next bat-only concert…


You must be logged in to reply to this topic.