bitfocus / companion-module-studiocoast-vmix

Studiocoast vMix module for Bitfocus Companion
MIT License
32 stars 10 forks source link

Fix audio meter calculation for decibels #198

Closed koirakuvat closed 1 year ago

koirakuvat commented 1 year ago

vMix audio meter values displayed by Companion are 40 dB too low. On line 221, division by 100 equals -40 dB. vMix gives meter values as amplitude between 0...1, where 1 is full scale (0 dB). https://www.vmix.com/knowledgebase/article.aspx/144/vmix-api-audio-levels

Function docstring also doesn't make full sense: (if the volume of a meter, multiply by 100 first)

thedist commented 1 year ago

You're correct in that the meters seem to be wrong, but your change is incorrect.

Initially those functions were used for the 'volume' vMix API returns, which is the fader on a bus or input. For example if I move a fader to about half way, it has a volume of 5.764802. Which when using the existing volumeTodB function will correctly return -24.78431209100794, which matches what vMix itself is displaying for the fader.

The meters, which were a more recently added function to the Companion module, I attempted to use the same function for conversion, but have simply forgot to multiply them in all places.

Your commit while fixing some meters that weren't multiplied before conversion, would completely break the volume variables.

koirakuvat commented 1 year ago

Thank you for the comment!