## Gain Table

chozillla
Posts: 5
Joined: Tue May 19, 2020 8:31 pm

### Gain Table

Hello,

I am having trouble understanding how the gain table works. I have 6 frequency bands and 2 input channels, so 6X2 = 12 total, I understand why there are 12. But if I were to increase the gain for both inputs at the 500 Hz band by 20 dB will I have to change the .gtdata to = [[0 0 0];[0 0 0];[20 20 20];[20 20 20];[20 20 20];[0 0 0];[0 0 0];[0 0 0];[0 0 0];[0 0 0];[10 10 10];[0 0 0]] to reflect this change? Also, what's the difference between [0 0 0] vs [0 0 0 0] in the .gtdata.

This is the code.

nchannels_in = 2
fragsize = 64
srate = 44100

# MHA library name
mhalib = transducers

# IO plugin library name
iolib = MHAIOJackdb

mha.calib_in.peaklevel = [90 90]
mha.calib_out.peaklevel = [90 90]

# list of plugins
fftfilterbank ...
dc ...
combinechannels ...
]

# Frequency bands
mha.overlapadd.mhachain.fftfilterbank.f = [250 500 1000 2000 4000 8000]

# gaintable data in dB gains
mha.overlapadd.mhachain.dc.gtdata = [[0 0 0];[0 0 0];[0 0 0];[0 0 0];[20 20 20];[0 0 0];[0 0 0];[0 0 0];[0 0 0];[0 0 0];[10 10 10];[0 0 0]]
# input level for first gain entry in dB SPL

# level step size in dB

# attack time constant in s

# decay time constant in s

# Name of fftfilterbank plugin. Used to extract frequency information.

Thank you

io.con_in = [system:capture_1 system:capture_1]
io.con_out = [system:playback_1 system:playback_2]

hendrikkayser
Posts: 3
Joined: Fri May 10, 2019 7:58 am

### Re: Gain Table

Hi,
to apply a gain of 20dB at your 500Hz band for both input channels and for all input levels - in addition to the +20dB @4kHz, 1st channel and +10dB @4kHz, 2nd channel - you have to set gtdata to

Code: Select all

[[0 0 0];[20 20 20];[0 0 0];[0 0 0];[20 20 20];[0 0 0];[0 0 0];[20 20 20];[0 0 0];[0 0 0];[10 10 10];[0 0 0]]

The structure of gtdata for your example is
[[ch1, 250Hz];[ch1, 500Hz];[ch1, ...];[ch1, ...];[ch1, ...];[ch1, ...];[ch2, 250Hz];[ch2, 500Hz];[ch2, ...];[ch2, ...];[ch2, ...];[ch2, ...]].

The difference between [0 0 0] and [0 0 0 0] is that the latter sets a gain value also for a higher input gain.

In combination with your starting point

Code: Select all

# input level for first gain entry in dB SPL
mha.overlapadd.mhachain.dc.gtmin = [0]
and the step size

Code: Select all

# level step size in dB