Go Back   Cockos Incorporated Forums > REAPER Forums > MIDI Hardware, Control Surfaces, and OSC

Reply
 
Thread Tools Display Modes
Old 10-28-2014, 12:35 PM   #1
Erriez
Human being with feelings
 
Join Date: Jun 2010
Location: The Netherlands
Posts: 177
Default How to convert volume in dB to OSC float value

How can I convert a volume in dB (say -6dB) to an OSC float value?

I made this table:
Code:
OSC value = Volume in dB
1.0 = +24dB
0.9 = +18.7dB
0.8 = +13.1dB
0.7 = +6.99dB
0.6 = 0dB
0.5 = -5.19dB
0.4 = -11.2dB
0.3 = -18.9dB
0.2 = -29.5dB
0.1 = -47.6dB
0.0 = -infdB
I think it should be easy, but I could not find a good calculation algorithm on this forum. :-) Any ideas?
Erriez is offline   Reply With Quote
Old 10-29-2014, 05:37 AM   #2
Banned
Human being with feelings
 
Banned's Avatar
 
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
Default

I think I may have that formula somewhere, but can't remember where...

In any case, you should realize that the 0dB point on volume faders (and - which I consider to be a severe design flaw - on *all* volume related parameters of its native effects, such as ReaComp threshold or ReaEQ band gain) depends on the setting used in REAPER > Preferences > Appearance > VU Meters/Faders > Volume fader range. For example, with a setting of +12 dB as maximum value, 0.0dB = 0.716.

Also, what exactly do you want/need to do that requires handling the conversion on your end? For setting a volume using a dB value, you can just send the desired dB value to REAPER via OSC directly, let REAPER handle the conversion itself, and report back to you.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
Banned is offline   Reply With Quote
Old 10-29-2014, 12:23 PM   #3
Erriez
Human being with feelings
 
Join Date: Jun 2010
Location: The Netherlands
Posts: 177
Default

As always, thanks for your fast response, Banned!

I was not aware of the setting "Volume fader range". So my trick is no solution. Let me explain my ideas.

I tried several tablet applications to control Reaper behind my drumkit for recording and practice sessions, but tablets won't work for me. I need real buttons and a big rotary knob which you can feel. That works better for me. There is currently no "Reaper Surface" (device) on the market which satisfies all my requirements. For this reason, I've developed a completely new (recording) surface from scratch. (I'm a hardware and software developer which is my fulltime job, music is my hobby)

Now I have a full functional prototype with +/- 75 features in a small case. That's a lot, except... controlling the metronome volume... A Python application runs on the PC which is a bridge between the device and Reaper. OSC is used to control Reaper.

I can use a rotary to send a track/master volume 1dB up/down command to Reaper by using action ID's:
Code:
/action/53517 (Track volume 1dB up)
/action/53518 (Track volume 1dB down)
/action/53514 (Master volume 1dB up)
/action/53515 (Master volume 1dB down)
Reaper responds with the track or master volume as string:
Code:
/track/1/volume/str ['-3.04dB']
/master/volume/str ['-4.04dB']
because my MyDevice.ReaperOSC contains:
Code:
TRACK_VOLUME s/track/@/volume/str
MASTER_VOLUME s/master/volume/str
This works fantastic, because this track volume string is displayed on a LCD. No db/float calculations are needed.

I need the same functionality for the metronome. AFAIK, there is no way to add new commands to a ReaperOSC file. It would be great if someone (Schwa? Maybe you?) can add a setting like:
Code:
METRONOME_VOLUME s/metronome/volume/str
I found the action ID 999 in Reaper: "Options: Set metronome volume (MIDI CC/OSC only)", but you told me there is no way to read it back (yet). Hmmm... So now I'm running out of ideas to display the metronome volume on my display...
Erriez 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:49 PM.


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