playing a wav file from BTE headset

Post Reply
bertankursun2
Posts: 12
Joined: Tue Nov 09, 2021 4:48 am

playing a wav file from BTE headset

Post by bertankursun2 » Tue Feb 07, 2023 12:10 am

Hi,

I am trying to play a wav file before my actual application that will involve dynamic compression plugin.
Below you can read my config file:

Code: Select all

nchannels_in = 2
fragsize = 64
srate = 24000

# MHA library name
mhalib = transducers

mha.calib_in.peaklevel = [65 65]
mha.calib_out.peaklevel = [71 71]

# IO plugin library name
iolib = MHAIOJackdb

mha.plugin_name = addsndfile
mha.addsndfile.filename = confirm_sound.wav
mha.addsndfile.levelmode = rms

mha.plugin_name = overlapadd

mha.overlapadd.fftlen = 256
mha.overlapadd.wnd.type = hanning
mha.overlapadd.wnd.len = 128
mha.overlapadd.wnd.pos = 0.5
mha.overlapadd.zerownd.type = hanning
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]
mha.overlapadd.mhachain.fftfilterbank.fscale = log
mha.overlapadd.mhachain.fftfilterbank.ftype = center

# gaintable data in dB gains
mha.overlapadd.mhachain.dc.gtdata = [[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[0 0 0];[0 0 0];[0 0 0];[0 0 0]]
mha.overlapadd.mhachain.dc.gtmin = [0]
mha.overlapadd.mhachain.dc.gtstep = [40]
mha.overlapadd.mhachain.dc.tau_attack = [0.02]
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

io.con_in = [system:capture_1 system:capture_2]
io.con_out = [system:playback_1 system:playback_2]
I can read and start the program, which starts working as a hearing aid (I can read hear the sound from the BTE).
Then, I am trying to play the sound file by writing any comment related to addsndfile plugin and I am receiving this error:

Code: Select all

mha.addsndfile.levelmode = rms
(mha_parser) Invalid entry: "addsndfile"
(MHA:failure)
Could you give me any suggestion? How should I play a sound file and then run my actual program?

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

Re: playing a wav file from BTE headset

Post by hendrikkayser » Tue Feb 07, 2023 6:43 am

Hello,
in your configuration the line

Code: Select all

mha.plugin_name = addsndfile 
is overwritten three lines below by

Code: Select all

mha.plugin_name = overlapadd
Use of the plugin mhachain can be used to resolve this:

Code: Select all

mha.plugin_name = mhachain
mha.mhachain.algos = [addsndfile overlapadd]
...
You'll have to modify the remaining configuration accordingly, e.g.,

mha.mhachain.overlapadd.fftlen = 256

bertankursun2
Posts: 12
Joined: Tue Nov 09, 2021 4:48 am

Re: playing a wav file from BTE headset

Post by bertankursun2 » Tue Feb 07, 2023 10:35 pm

It works. Thank you very much!

I also needed to add the path and channels specifically. This is a piece of code for anyone who checks in the future:

Code: Select all

nchannels_in = 2
fragsize = 64
srate = 24000

# MHA library name
mhalib = transducers

mha.calib_in.peaklevel = [65 65]
mha.calib_out.peaklevel = [71 71]

# IO plugin library name
iolib = MHAIOJackdb

mha.plugin_name = mhachain
mha.mhachain.algos = [addsndfile overlapadd]

mha.mhachain.addsndfile.filename = confirm_sound.wav
mha.mhachain.addsndfile.levelmode = rms
mha.mhachain.addsndfile.path = /home/mha/
mha.mhachain.addsndfile.channels = [0 1]
mha.mhachain.addsndfile.loop = no

mha.mhachain.overlapadd.fftlen = 256
mha.mhachain.overlapadd.wnd.type = hanning
mha.mhachain.overlapadd.wnd.len = 128
mha.mhachain.overlapadd.wnd.pos = 0.5
mha.mhachain.overlapadd.zerownd.type = hanning
mha.mhachain.overlapadd.plugin_name = mhachain

# list of plugins
mha.mhachain.overlapadd.mhachain.algos = [ ... 
fftfilterbank ... 
dc ... 
combinechannels ...
]

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

# gaintable data in dB gains
mha.mhachain.overlapadd.mhachain.dc.gtdata = [[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[10 10 10];[0 0 0];[0 0 0];[0 0 0];[0 0 0]]
mha.mhachain.overlapadd.mhachain.dc.gtmin = [0]
mha.mhachain.overlapadd.mhachain.dc.gtstep = [40]
mha.mhachain.overlapadd.mhachain.dc.tau_attack = [0.02]
mha.mhachain.overlapadd.mhachain.dc.tau_decay = [0.1]

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

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

Post Reply