Page 1 of 1
Using Monitor Object to show DB
Posted: 08 Dec 2011 08:31
by Juggla+
Hello,
Im trying to make the monitor object show the DB for my gain knob in traktor. Right now it just displays the midi information. Any idea what the conversion is?
Re: Using Monitor Object to show DB
Posted: 09 Dec 2011 20:53
by mbncp
Formula is
20*Log10(x) so that 0.0 -> -inf, 1.0 ->0.0 db, 2.0 -> 6 db
When converting from MIDI often 0 -> -inf, 100 is 0 db and 127 is 6 db, but that's up to the app
Now I don't know what is the formula to make 0 = 0.0 (or a least close to 0), 100 = 1.0 and 127 = 2.0 as I don't think it's linear, maybe the easiest is to store some values in an array.
Re: Using Monitor Object to show DB
Posted: 10 Dec 2011 06:33
by Juggla+
basically i have a fader and then above it a monitor to display the gain information.
How can I implement the formula into the text? Using a script? Im not so good with the scripting aspects so sorry if this is a really obvious question
Re: Using Monitor Object to show DB
Posted: 10 Dec 2011 08:46
by mbncp
If you have a fader called Fader, then just enter this into the monitor value field:
20*log10(Fader.x)
This will display values from -inf to 0.0 db
To display values from -inf to 6 db you can enter this
20*log10(Fader.x*2)
If you need something more fancy you may need a multiline script.
First, remove the formula you had in the monitor value.
Select your fader, add a script (bottom right in the editor), select On Expression and type x in the box on the right
Now, below, you could enter something like:
decl n, aDB = {'-inf', -96,-48,-24,-12,-6,-3,0,3,6,12};
n = sizeof(aDB)-1;
Monitor.value = aDB[x*n];
You may adjust the array to your needs.
Re: Using Monitor Object to show DB
Posted: 10 Dec 2011 10:17
by Macciza
Hi All,
I found another formula option that matches closer to Live's faders : 20*(log(x*127/108))*6/3.241
Then I realised/remembered that you wanted it for NI Traktor not Live, and for the Gain (+/- 12 Trim) not the actual Fader . . .
So, a few suggestions - Try a Knob or Slider as they can be set to Bipolar which gives you the centre 0dB mark better . . .
And then try this variation on mbncp's script, and set the Precision to 1
decl n, aDB = stretch({-12,12},12);
n = sizeof(aDB)-1;
Monitor.value = aDB[x*n];
Hope that helps
Cheers
MM
Re: Using Monitor Object to show DB
Posted: 10 Dec 2011 10:56
by mbncp
20*(log(x*127/108))*6/3.241
Thanks MM for that one
Re: Using Monitor Object to show DB
Posted: 10 Dec 2011 13:30
by Macciza
No worries
Though it's not my work - I think it probably came from the MutantTalk forum originally . . .
If you are interested there is also this equation which I found in my Tech archives - though it deals with velocity I think it could be useful, though i have not worked it out yet . . .
Musically map MIDI velocity to peak amplitude within a specified dynamic range in decibels: a = (m * v + b) ^ 2, where a = amplitude, v = MIDI velocity, r = 10 ^ (R / 20), b = 127 / (126 * sqrt( r )) - 1 / 126, m = (1 - b) / 127, and R = specified dynamic range in decibels. See Roger Dannenberg, "The Interpretation of MIDI Velocity," in Georg Essl and Ichiro Fujinaga (Eds.), Proceedings of the 2006 International Computer Music Conference, November 6-11, 2006 (San Francisco: The International Computer Music Association), pp. 193-196.
The document itself is an interesting read . . .
Cheers
MM
Re: Using Monitor Object to show DB
Posted: 17 Jul 2012 14:43
by Stephmo
20*(log(x*127/108))*6/3.241
This formula doesn't match with the levels indicated in Live. Sent a mail to the Ableton support to get something more precise on this subject but got no answer. Did someone impoved it ?