# Calculating vocoder filter gain and loss

The following table shows decibel gain values and their associated linear gain/loss values:

Decibel gain/loss | Gain | Loss
0 dB | 0x0400 | NA
1 dB | 0x047D | 0x0391
2 dB | 0x0509 | 0x032D
3 dB | 0x05A6 | 0x02D5
4 dB | 0x0657 | 0x0286
5 dB | 0x071D | 0x0240
6 dB | 0x07FB | 0x0201
7 dB | 0x08F4 | 0x01C9
8 dB | 0x0A0C | 0x0198
9 dB | 0x0B46 | 0x016B
10 dB | 0x0CA6 | 0x0144
11 dB | 0x0E31 | 0x0121
12 dB | 0x0FED | 0x0101
13 dB | NA | 0x00E5
14 dB | NA | 0x00CC
15 dB | NA | 0x00B6
16 dB | NA | 0x00A2
17 dB | NA | 0x0091
18 dB | NA | 0x0081
squelch | NA | 0x0000

## Converting from decibels to API logarithmic units

Use the following formula to convert values from dB to API logarithmic units (where DSP 0 dB ref is equivalent to 1024 (0x0400)):

API Units = ( DSP 0 dB ref ) * (10^(dB/20))
For example, to compute a 3dB gain value:
3dB API Units = 1024 * 10^(3/20)
1024 * 10^(.15)
1024 * 1.4125
1446
0x05A6