dB to Linear Taper Sum

Forums Forums SQ Forums SQ general discussions dB to Linear Taper Sum

This topic contains 4 replies, has 2 voices, and was last updated by Profile photo of SignalAudio SignalAudio 3 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #100224
    Profile photo of SignalAudio
    SignalAudio
    Participant

    Hi there,

    I use the TCP MIDI protocol a lot for automation from third party devices, and often need to fade up and down different sources. This ends up being quite a clunky thing to code into the controlling device as differences in fade duration require different arrays of 16-bit preset values (per the linear taper in the MIDI protocol documentation).

    What would help greatly is knowing the mathematical relationship between the decibel value and the 16-bit linear taper value. This would mean I could program my devices to calculate the target value on the run. I’ve tried to suss it out and my wife – a statistician – couldn’t even get a particularly accurate coefficient with her clever software.

    Would A&H be happy to furnish us with this? It would apply more broadly than SQ of course.

    Many thanks!

    #100226
    Profile photo of MaxKiusso
    MaxKiusso
    Participant

    The linear taper value is a decimal integer value between 0 and 16,383 and divided into two hexadecimal values that are both part of the value in binary mode: VC and VF.

    VF is the last 7 bits of the value and VC is what remains after removing the last 7 bits.

    Example: if you have a value of 15.196 (0 dB) the binary (max 14 bits) representation is 11101101011100 and hexadecima values are

    VC = 1110110 = 0x76
    VF = 1011100 = 0x5C

    Other example: value 8,056 (about -60 dB) is 1111101111000 so

    VC = 111110 = 0x3E
    VF = 1111000 = 0x78

    I’ve developed a formula that returns decimal values from dB level:

    decimal = integer_part(15196 + (db_level * 119))

    I use this logical into my Companion module for SQ. I hope it will be useful to you.

    #100227
    Profile photo of SignalAudio
    SignalAudio
    Participant

    Hi Max,

    This is very cool. I just sussed the 14-bit structure as I got the notification of your post – it was fishy that the LSB never rose above 127. I like your formula, but it does have a little – almost insignificant – error against A&H’s own table, so it’s not the sum they use, seemingly.

    I recreated their hex table in the B column of a spreadsheet and wrote this function to strip the 8th bit of the LSB and shift the MSB down: =BITOR(BITRSHIFT(HEX2DEC(LEFT($B2,2))*256,1),HEX2DEC(RIGHT($B2,2)))

    Your sum, working the other way from decibels (the A column in the same spreadsheet) is out by 1 at -2dB and 10 at -35dB. I wondered if it was a rounding error (integers always rounding down to the whole number), but it appears not to be, or not with your sum in this case.

    Definitely not a criticism, your sum is very, very close!

    Cheers..

    #100230
    Profile photo of MaxKiusso
    MaxKiusso
    Participant

    I know that my formula has a bit error, only for average I using. I arrived to write “db_level * 119” because the average distance from one dB to another is “119” (0111), sometimes 118 and sometimes 120.

    I think A&H’s calculations are also not accurate and in some cases what you send is not always interpreted correctly by SQ. Ad example, I send pan level to SQ for centering (3F & 7F like indicated in table of the manual) and after 200 ms I ask to it for that value: it reply with “3E & 22” (difference of 0xDD) that it is about “Left 3%”.

    If I will find a way to improve the formula, I’ll share it with you. Hope you will do the same! (or A&H technicians unravel the mystery)

    #100241
    Profile photo of SignalAudio
    SignalAudio
    Participant

    I will gladly do the same! 118.725 is almost perfect if you use conventional rounding to zero decimal places, and within +1 with integer rounding, FWIW.

    Cheers.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.