Old 05-30-2020, 06:02 PM   #1
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default Math question about inverting a value

vol = reaper.GetMediaTrackInfo_Value( tr, "D_VOL" )
console outputs
3.981071705535
for +12 db
How to get the inverse of this number ?
10^(x/20)
Is their a simple function for this ?
Thanks.
J.
J Reverb is offline   Reply With Quote
Old 05-30-2020, 06:15 PM   #2
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

The answer is in your question. You need to find the inverse function of 10^(x/20).

20*log10(x) or 20*ln(x)/ln(10) depending on what log base you want to use.
ErBird is offline   Reply With Quote
Old 05-30-2020, 06:40 PM   #3
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Ah right I'm still learning this stuff

Will try that out thank you, thank you !
J Reverb is offline   Reply With Quote
Old 05-31-2020, 01:09 PM   #4
J Reverb
Human being with feelings
 
Join Date: Jul 2009
Posts: 1,071
Default

Thanks,
So this works to get back to the readable number.

vol = x;
inverted_vol = 20*log10(vol);
newvolume = (ceil(inverted_vol * 10) /10);
Is there a quicker way to do this ?

Ta.
J Reverb is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:24 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.