calculation question...

Learn about building and using Max for Live devices.
Post Reply
3dot...
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 ?
Image

r_v
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)

3dot...
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
Image

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

3dot...
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..


<pre><code>
----------begin_max5_patcher----------
772.3ocyX90aaBCD.+YpT+NXwyMHaB1P1aaeMlphb.uDOAlHvIMaU6697efR
RKYwIqE2Whityfu6mu67Yd996BBWUef0FB9B36fffmURBLxzRB5EDDVQOjWR
aMSLLutphIjgOzoTxNHMJZnO8hPwtJtnjIMOBpWJuvLw5U+bVF434VuS1OYX
u3eTKjs7eyLuAXzKx2Rk4a3h0KaX4RqoOeNQoGDOOVOLGo+EkEAAOd7KSPqL
urvu1vokfuUWVDZT+m6uSOpFdvYJTwZaoqYukByhyhhGmCwiwgjyvAzk3fct
xeskYgPX3f6NBivHKbfI5ALzvHxGJiDrmTt3aQTaNsjAfQ.TDXVpZjn+63Li
LFyhmVlESLLCAgSPf04fVix1Yf8zxcL2yxRwuL2sMrVUZKUxqEG4hIIVWL13
hvteF7uSAb70C3GtDjSRfGYAcn1OLVBVAJuB5RtHcIlBSHabz6OcWQEqcfvc
PsqBPbD1aDtrlVXMZmgb5EgrsX1rLWXL51X7EhfyFL.L1iAvk78rHkFso47Q
PoYNVj.sH9iAwNUfna0wKbmu85ao6YEKsbYIUJa3qTESa6HbOhCBWtk0zxak
LQt0nsJ51gd+2oTN6lqHSXgiYBoNsMM+1pk6P87rAi.60dwz7EH2vaWVv1yy
YfbpnVvUserbKsQAPPE+.qoW695xcUCulRtfkWuSHOgVWtiNniaStcj66e1T
1vh2ejvB+r+rlI+WczLJcQtVrh.8YwJ6piSlf1rOKdgQX7UbLvTcSj4XaKmX
xjcSjyeaMbj5bkzjrwy5icmdS0cRRf172L3.8hS8R2FTYcwJ2O+hjFNo4fcA
Xyyt4ifrOfIj30ejDyxpU7Jv0VuqIu2L6urJ3nktf0J4BSQqimkJ4CfFl0Fd
QASbx2CohWrslKjcVB3wyue5rwouenCF2qbgOUFW5mYxoC48.4zsf3.4V3ms
0Tmh4f9gbHmHWleHGwIxg7iws3z7vyPNh+HGxosUOTJIyoXNrWHGworUc2O+
mjSKPM7WiTsdzA
-----------end_max5_patcher-----------
</code></pre>
Image

broc
Posts: 1151
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".

http://forum.ableton.com/viewtopic.php? ... ogarithmic

3dot...
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".

http://forum.ableton.com/viewtopic.php? ... ogarithmic
hmm....
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..)
Image

Post Reply