Hi,
I would like to implement a beam former for a real-time application, with minimum delay as possible.
It doesn't need to be estimating the direction of arrival, or adaptive. I am fine with fixing the steering direction.
Could you please help me with the configurations? I am a little bit confused since the examples are using pre-computed HRTFs to be used with .wav files.
Thank you!
Directional Beamforming
Re: Directional Beamforming
Bertan,
The 'adm' plugin is a standard directional algorithm used in the industry. No HRTFs involved. It's used with the 'decomb' plugin to equalize the low frequency rolloff that naturally happens with directional microphones.
I'm adding this algorithm to the example program you've been using. I'll send it to you to check out.
Nick
The 'adm' plugin is a standard directional algorithm used in the industry. No HRTFs involved. It's used with the 'decomb' plugin to equalize the low frequency rolloff that naturally happens with directional microphones.
I'm adding this algorithm to the example program you've been using. I'll send it to you to check out.
Nick
Re: Directional Beamforming
nmichael wrote: ↑Thu Apr 18, 2024 4:10 pmBertan,
The 'adm' plugin is a standard directional algorithm used in the industry. No HRTFs involved. It's used with the 'decomb' plugin to equalize the low frequency rolloff that naturally happens with directional microphones.
I'm adding this algorithm to the example program you've been using. I'll send it to you to check out.
Nick
Hey I have the same situation but I need to change the beamforming direction in real time.
I have tried running beamformer example, using a pure tone input only and also write it to wav file. The output is same frequency in the file. But in my batandcat hearing aid I hear nothing.
Could I ask what might contribute to no sound at all? Is it possible with real time safety issues?
Would really appreciate some input.
Best.
Re: Directional Beamforming
I was able to get this to run on the PHL, I'm not sure if the algorithm is working correctly but it makes noise and does phasey things when you move the sound source around. The input/output is kind of funky and I'm not sure I understand the mha details. It uses about 23% of the CPU so it's not a realtime issue.
I changed the inputs to
nchannels = 6
...
mha.bfChain.left_in.out = [:0 :1 :4 :5]
mha.bfChain.left_in.ac = [:0 :1 :4 :5]
So that's [Front L, Front R, Rear L, Rear R] on the PHL. I'm not sure how the ac variable works here in this algorithm but I think this is right. Maybe one of the openMHA wizards is reading this and can comment.
The output is
mha.bfChain.out.out = [right_in:0 :0 :0 :0 :0 right_in:0 :0]
That will use the line output also. I don't quite understand the signals here (right_in:0, :0) to be honest. I'd need to look at the algorithm closer. (For me it's easier to test these directional algorithms with fully occluding earbuds instead of open fit. Of course the BTEs still have to be on someone's head.)
I'm not sure how you're running this but make sure RegSet.sh gets run first. If you need help setting things up just let me know.
I don't seem to be able to attach files here so here's the modified beamformer.cfg:
----------------------------------------------------------------------
srate = 16000
nchannels_in = 6
fragsize = 160
iolib = MHAIOalsa
io.in.device=hw:0
io.out.device = hw:0
io.priority=90
mhalib = overlapadd
# configure OA node for steering beamformer filters
mha.fftlen = 512
mha.wnd.len = 320
mha.zerownd.type = hanning
mha.plugin_name = mhachain:bfChain
mha.bfChain.algos = [route:left_in acSteer:mvdr steerbf:left route:right_in steerbf:right route:out]
#mha.bfChain.left_in.out = [:0 :1 :2 :3]
mha.bfChain.left_in.out = [:0 :1 :4 :5]
mha.bfChain.left_in.ac = [:0 :1 :4 :5]
#configure steervec for the left reference microphone
mha.bfChain.mvdr.steerFile = MVDR_iso_norm_bte_16KHz_4ch_lr_FFT512_-180-5-180.txt
mha.bfChain.mvdr.nsteerchan = 584
mha.bfChain.mvdr.acSteerName1 = acSteerLeft
mha.bfChain.mvdr.acSteerName2 = acSteerRight
mha.bfChain.mvdr.nrefmic = 2
#configure steerbf for the left reference microphone
mha.bfChain.left.bf_src = acSteerLeft
mha.bfChain.left.angle_ind = 40
# route the input signal to the beamformer with the right reference microphone
mha.bfChain.right_in.out = [left_in:0 left_in:1 left_in:2 left_in:3]
mha.bfChain.right_in.ac = [:0]
#configure steerbf for the right reference microphone
mha.bfChain.right.bf_src = acSteerRight
mha.bfChain.right.angle_ind = 40
# route the filter outputs of the left and right beamformers to the output
#mha.bfChain.out.out = [right_in:0 :0]
mha.bfChain.out.out = [right_in:0 :0 :0 :0 :0 right_in:0 :0]
I changed the inputs to
nchannels = 6
...
mha.bfChain.left_in.out = [:0 :1 :4 :5]
mha.bfChain.left_in.ac = [:0 :1 :4 :5]
So that's [Front L, Front R, Rear L, Rear R] on the PHL. I'm not sure how the ac variable works here in this algorithm but I think this is right. Maybe one of the openMHA wizards is reading this and can comment.
The output is
mha.bfChain.out.out = [right_in:0 :0 :0 :0 :0 right_in:0 :0]
That will use the line output also. I don't quite understand the signals here (right_in:0, :0) to be honest. I'd need to look at the algorithm closer. (For me it's easier to test these directional algorithms with fully occluding earbuds instead of open fit. Of course the BTEs still have to be on someone's head.)
I'm not sure how you're running this but make sure RegSet.sh gets run first. If you need help setting things up just let me know.
I don't seem to be able to attach files here so here's the modified beamformer.cfg:
----------------------------------------------------------------------
srate = 16000
nchannels_in = 6
fragsize = 160
iolib = MHAIOalsa
io.in.device=hw:0
io.out.device = hw:0
io.priority=90
mhalib = overlapadd
# configure OA node for steering beamformer filters
mha.fftlen = 512
mha.wnd.len = 320
mha.zerownd.type = hanning
mha.plugin_name = mhachain:bfChain
mha.bfChain.algos = [route:left_in acSteer:mvdr steerbf:left route:right_in steerbf:right route:out]
#mha.bfChain.left_in.out = [:0 :1 :2 :3]
mha.bfChain.left_in.out = [:0 :1 :4 :5]
mha.bfChain.left_in.ac = [:0 :1 :4 :5]
#configure steervec for the left reference microphone
mha.bfChain.mvdr.steerFile = MVDR_iso_norm_bte_16KHz_4ch_lr_FFT512_-180-5-180.txt
mha.bfChain.mvdr.nsteerchan = 584
mha.bfChain.mvdr.acSteerName1 = acSteerLeft
mha.bfChain.mvdr.acSteerName2 = acSteerRight
mha.bfChain.mvdr.nrefmic = 2
#configure steerbf for the left reference microphone
mha.bfChain.left.bf_src = acSteerLeft
mha.bfChain.left.angle_ind = 40
# route the input signal to the beamformer with the right reference microphone
mha.bfChain.right_in.out = [left_in:0 left_in:1 left_in:2 left_in:3]
mha.bfChain.right_in.ac = [:0]
#configure steerbf for the right reference microphone
mha.bfChain.right.bf_src = acSteerRight
mha.bfChain.right.angle_ind = 40
# route the filter outputs of the left and right beamformers to the output
#mha.bfChain.out.out = [right_in:0 :0]
mha.bfChain.out.out = [right_in:0 :0 :0 :0 :0 right_in:0 :0]
Re: Directional Beamforming
I think I reversed the signal outputs in the line outs, should probably be:
mha.bfChain.out.out = [right_in:0 :0 right_in:0 :0 :0 :0 :0]
mha.bfChain.out.out = [right_in:0 :0 right_in:0 :0 :0 :0 :0]