Page 1 of 1

Gain Table

Posted: Wed Jun 24, 2020 1:42 am
by chozillla
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.plugin_name = overlapadd

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

mha.overlapadd.fftlen = 256
mha.overlapadd.wnd.len = 128
mha.overlapadd.plugin_name = mhachain

# list of plugins
mha.overlapadd.mhachain.algos = [ ...
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
mha.overlapadd.mhachain.dc.gtmin = [0]

# level step size in dB
mha.overlapadd.mhachain.dc.gtstep = [40]

# attack time constant in s
mha.overlapadd.mhachain.dc.tau_attack = [0.02]

# decay time constant in s
mha.overlapadd.mhachain.dc.tau_decay = [0.1]

# Name of fftfilterbank plugin. Used to extract frequency information.
mha.overlapadd.mhachain.dc.fb = fftfilterbank
mha.overlapadd.mhachain.dc.chname = fftfilterbank_nchannels
mha.overlapadd.mhachain.combinechannels.outchannels = 2

Thank you


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

Re: Gain Table

Posted: Thu Jun 25, 2020 10:00 am
by hendrikkayser
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                                                                                                                                                                
mha.overlapadd.mhachain.dc.gtstep = [40]

this means for [0 0 0] that 0dB gain is set for 0dB, 40dB, and 80dB input levels, for [0 0 0 0] a value is additionally set for 120dB.

Re: Gain Table

Posted: Thu Jun 25, 2020 7:44 pm
by chozillla
Thank you so much!