Author Topic: Ask DB question  (Read 231 times)

one808

  • Posts: 10
Ask DB question
« on: 22 Sep '22 - 02:29 »
BASS_ChannelGetLevel()
L/R:0-32768 How to convert to db?

Chris

  • Posts: 2169
Re: Ask DB question
« Reply #1 on: 22 Sep '22 - 05:17 »
e/g something like this

Code: [Select]
function LinToDB(Volume: integer; Base: integer = 32768): integer;
begin
  if (Volume <= 0) then
    Result := -50 // to prevent overflow
  else
    Result := round(Log10(abs(Volume) / Max(Base, 1)) * 20);
end;