calculation question...

Questions and discussion about building and using Max for Live devices
Post Reply
Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

calculation question...

Post by 3dot... » Sun Mar 25, 2012 2:16 am

if say..
I want to add 4 dB to the current tracks' volume position...
how do I scale the dB value >> to the linear (0.- 1.) scale that the 'mixer volume value' accepts/observes ?

Posts: 21
Joined: Mon Jun 09, 2008 1:15 pm

Re: calculation question...

Post by r_v » Sun Mar 25, 2012 2:37 am

multiply by 1.58489319.

10^(4 / 20) = 1.58489319

to convert log value x to linear: 10^(x/20)

to convert linear value x to log: 20*log10(x)

Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: calculation question...

Post by 3dot... » Sun Mar 25, 2012 3:18 am

hmmm. thanks..and sorry I'm a bit thick..
but..this doesn't work for me..

the slider value observed is 0.85 (at 0 dB)..
multiplying by that number goes over the 1. limit of the range (it's supposed to be 4 dB no ?)
0. - 1. is supposed to scale -70.dB to 6dB..
please help

Posts: 354
Joined: Thu Nov 05, 2009 9:51 am

Re: calculation question...

Post by pid » Sun Mar 25, 2012 9:45 am

you might want to check out the [dbtoa] and [atodb] objects which do this for you.

however, there is confusion here. scaling linear amplitude (0. - 1. - +++) is easy. however, you i think are talking about 'normalised value' which live will spit out. if dealing with the right hand outlet of a live.* object this is easy of course, but if you are dealing with a queried value then it is more complicated. sometimes impossible, depending on if that queried value is scaled linearly itself or some other scaling factor. it seems like it is not scaled linearly, as you say 0.dB is 0.85, whereas as in that scenario my maths brings it out (linear scale) at about 0.92...ish. also, remember, -70.db does not equal 0. amplitude!

sorry not to help more. case by case. probably more info needed to work out.
3dot... wrote: in short.. we live in disappointing times..

Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: calculation question...

Post by 3dot... » Sun Mar 25, 2012 10:23 am

pid... once again your are right (about everything)

(sorry I've missed the whole high-school "experience")

how can I deduct the scaling value where :
1. = +6dB

0.85 = 0dB

0.55 = -12dB

0.001154 = -69.5 (the last value displayed in the live gui..anything below displays as -inf)

0.000112 = -69.95
(shown in live as "-inf" although you can enter the value in the box..
and as m4l api shows.. the value is accepted)

strangely enough -69.99 value shows '2.24296527449e-005' ..that's friggin weird !I'm guessing a bug ?

0. = -inf (is what I meant to represent with -70.0..)

I want to "watch" the volume slider.. (0.-1.)
get the REAL dB value of the volume..
and add/subtract from it in dB
(then convert the number back to 0. -1. range..back to the slider)

I'm stuck at getting the real dB value of the volume slider..

thanks again for all your help guys ... hope to find an answer to this..


Posts: 1148
Joined: Mon Jul 26, 2004 8:37 am

Re: calculation question...

Post by broc » Sun Mar 25, 2012 11:57 am

Here is a related thread with "solution". ... ogarithmic

Posts: 9996
Joined: Tue Feb 20, 2007 11:10 pm

Re: calculation question...

Post by 3dot... » Sun Mar 25, 2012 12:16 pm

broc wrote:Here is a related thread with "solution". ... ogarithmic
I'm guessing this is the only current "solution" ... ?

stephan 'sampled' the values... it's not ideal...
thought about doing it.. but decided not to..I want to be as precise as possible

but how to get to the real scaling function ?

Ableton programmers maybe able to chime in with the actual function ?

this is one of those things again...
why do I hit walls for seemingly trying to achieve simple tasks in m4l?
(rhetorical I think..)

Post Reply