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?
Using Monitor Object to show DB
Re: Using Monitor Object to show DB
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.
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
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
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
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.
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
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
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
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Using Monitor Object to show DB
20*(log(x*127/108))*6/3.241
Thanks MM for that one
Re: Using Monitor Object to show DB
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
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
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
Re: Using Monitor Object to show DB
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 ?
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 ?