I’m trying to see if a certain channel peaked using FMOD_DSP_METERING_INFO.peaklevel.
If its unit was dB, I could just check if it’s greater than 0.
Also, can FMOD_ChannelGroup_GetAudibility() be used for this purpose?
I’m trying to see if a certain channel peaked using FMOD_DSP_METERING_INFO.peaklevel.
If its unit was dB, I could just check if it’s greater than 0.
Also, can FMOD_ChannelGroup_GetAudibility() be used for this purpose?
Audibility is measured in linear volume, not dB and it’s based on any significant modifiers of the output volume. It doesn’t look at the actual samples of the signal, just things affecting them, like faders.
Instead, you should be able to use the FMOD_DSP_TYPE_LOUDNESS_METER in order to measure the actual peak of a signal.
Is that a public API we can use?
I searched here before asking my question.
The reason why I was testing FMOD_DSP_METERING_INFO and FMOD_ChannelGroup_GetAudibility() was, I thought we couldn’t use FMOD_DSP_TYPE_LOUDNESS_METER after reading this and this answers from your team.
Do you mean I can use FMOD_DSP_GetMeteringInfo() with FMOD_DSP_TYPE_LOUDNESS_METER?
It seems there’s no other public function that can retrieve a value from FMOD_DSP_TYPE_LOUDNESS_METER…
Really, nobody from the FMOD team knows about this?
My apologies for the delay. We have been discussing internally and have scoped in making DSP_LOUDNESSMETER_INFO public for an upcoming release. It won’t be in the next release but hopefully for the release after. In the meantime you can convert the linear volume into dB.
“We have been discussing internally and have scoped in making DSP_LOUDNESSMETER_INFO public for an upcoming release.”
Honestly, I didn’t expect this. Great to hear the news and thanks a lot to you and your team!
“you can convert the linear volume into dB.”
In fact, this was my initial question. I thought there was some way to convert the linear value.
But how? Could you at least give me a hint?
Update: Is this a correct way to get a volume in dB?
float db = 10.0f*logf(lin > 0.99f ? 0.01f : 1.0f - lin);
Update2: It seems like the correct answer is this…?
db = 20 * log10(lin)
I rather find dB = 6 * ln(lin) / ln(2)
but it seems to give almost the same result. I’m not math savvy enough to explain why, though!
I got some equations after searching here for hours, and the last one was the most mentioned expression by many developers including the former FMOD team member.
And if your way also returns a similar result, then I think both can be used.
Thanks.
My formula comes from the resolution of those hypothesis:
*2 lin = +6 dB
0 dB = 1 lin
Not sure what’s the logic behind the other formula.
This can help you
20 * log(lin)
is an approximation, 6 * ln(lin) / ln(2)
is the exact formula.
Check lin = 0.5, the first one gives -6.0206 dB, while the second gives exactly -6 dB.
Checked
The reverse is also true:
lin = 10^(db / 6 * log(2))
Thanks!