Acoustic Beamforming using Microphone Array : Recorded Multi Channel Audio

I have recorded three directional sound source (at angles [-50;0], [-10; 0], [50; 0]) using a "4 channel Linear Microphone Array".
I am trying to use "MicrophoneBeamformerExample.m" (<http://www.mathworks.com/help/phased/examples/acoustic-beamforming-using-a-microphone-array.html>) to extract the audio from a specific direction.
I have tried the following
a) Create the 4 Channel Linear Microphone Array in MATLAB using phased.OmnidirectionalMicrophoneElement, phased.ULA. This is to recreate the same Array as was used to record the audio in first place.
b) Use Step function to create sigArray
c) Use "phased.TimeDelayBeamformer" and try to extract the audio from specific direction.
But I am not getting the desired output. Below is my code. Any help is highly appreciated.
**************************************************************************************
h = phased.OmnidirectionalMicrophoneElement('FrequencyRange',[20 20e3]);
Nele = 4;
%ha = phased.ULA(Nele,0.05,'Element',hmic);
ha = phased.ULA('Element',h,'NumElements',Nele,...
'ElementSpacing',0.05);
%ha = phased.ULA(Nele,0.05,'Element',h);
c = 340; % sound speed, in m/s
oFeq = 16000;
ang_1 = [10; 0];
ang_2 = [-50; 0];
ang_3 = [ 50; 0];
fs = 16000;
%fs = AudioInput.SampleRate;
t_duration = 29;
t = 0:1/fs:t_duration-1/fs;
NSampPerFrame = 1000;
NTSample = t_duration*fs;
sigArray = zeros(NTSample,Nele);
isAudioSupported = helperMicrophoneExampleAudioSupported;
if isAudioSupported
hap = dsp.AudioPlayer('SampleRate',fs);
end
audioFileName = 'ABC_FourChannel_Recording.wav';
AudioInput = dsp.AudioFileReader(...
'OutputDataType','double',...
'Filename', audioFileName,...
'PlayCount', inf, ...
'SamplesPerFrame', NSampPerFrame);
for m = 1:NSampPerFrame:NTSample
sig_idx = m:m+NSampPerFrame-1;
sigArray(sig_idx,:) = step(AudioInput);
end
angSteer = ang_3;
hbf = phased.TimeDelayBeamformer('SensorArray',ha,'SampleRate',fs,...
'Direction',angSteer,'PropagationSpeed',c);
hsig = dsp.SignalSource('Signal',sigArray,...
'SamplesPerFrame',NSampPerFrame);
cbfOut = zeros(NTSample,1);
for m = 1:NSampPerFrame:NTSample
temp = step(hbf,step(hsig));
if isAudioSupported
step(hap,temp);
end
cbfOut(m:m+NSampPerFrame-1,:) = temp;
end
plot(t,cbfOut);
xlabel('Time (Sec)'); ylabel ('Amplitude (V)');
title('Time Delay Beamformer Output'); ylim([-3 3]);
hbf = phased.FrostBeamformer('SensorArray',ha,'SampleRate',fs,...
'PropagationSpeed',c,'FilterLength',20,'DirectionSource','Input port');
reset(hsig);
FrostOut = zeros(NTSample,1);
for m = 1:NSampPerFrame:NTSample
%FrostOut(m:m+NSampPerFrame-1,:) = step(hbf,step(hsig),ang_dft);
%FrostOut(m:m+NSampPerFrame-1,:) = step(hbf,step(hsig),ang_cleanspeech);
FrostOut(m:m+NSampPerFrame-1,:) = step(hbf,step(hsig),ang_3);
end
if isAudioSupported
release(hap);
step(hap,FrostOut);
end
plot(t,FrostOut);
xlabel('Time (sec)'); ylabel ('Amplitude (V)');
title('Frost Beamformer Output'); ylim([-3 3]);
**************************************************************************************

1 Comment

Hello Ashwini, hope you are doing well.
Did you maybe get this to work? I know it has been a long time since you posted this question, but right now I'm working on a similar project.
I'm looking to apply beamforming to a ps3 eye recording and my code looks very similar to yours but It's not working either.
If you got this working, I would really appreciate any insight you can provide me with.
Thanks in advance.

Sign in to comment.

Answers (2)

Are you using one wav file for all four channels? For beamformers to work, you will need four separate signals from each microphone, otherwise there is really just one channel.
HTH

5 Comments

Hi Honglei,
Thanks so much for the prompt reply. I have few queries, if you can clarify.
1) If I record each channel separately, will that specific channel has to treated as the output for a specific direction sound. If the answer is yes, then that puzzles me a bit. Because, how I will ever to able extract specific directional speaker, if two or three speakers are speaking simultaneously.
In asking this question I am keeping in mind the example and this specific line
temp = step(hCollector,[x1 x2 x3],... [ang_dft ang_cleanspeech ang_laughter]) + ... sqrt(noisePwr)*randn(NSampPerFrame,Nele);
In this case, during simulation, each channel is given a specific direction, as I understand.
2) If I record three separate Wave file for each directional speaker using same Four Channels for each direction, will that work with the Beamformer ?
3) What about the case of Live Recording from Four Channels ? How can I use Beamformer to work with Live Recording.
And again, thankyou so much for your reply.
Warm Regards
Ashwini
Hi Ashwini
1) No, each record can have a combination of sound from all directions, you just need to have signal from individual channel to do beamforming. In the code example, it basically means the array is receiving 3 signals from 3 different directions, however, at each individual element, they receive all 3 of them. it's the relation between the elements that enables beamforming
2) The reality is you won't be able to do this, otherwise the problem is already solved. You normally get a combination of different sounds. These sounds are present simultaneously and you want to separate them.
3) The live recording should be fine, as long as you have signal from individual elements.
HTH
Hi Honglei,
Thanks again for your answers. Can you please look at MATLAB example : AudioArrayDOAEstimationExample.m
In that case recorded audio is from "Microsoft Kinect" microphones array and its output is a single ".wav" file with four channels as four columns of the matrices (after we perform the step function).
In that case Direction of Arrival (DOA) estimation is done correctly to an extent.
If I have the similar kind of '.wav' file (say from Kinect microphone), can we not perform the Beamforming using that '.wav' file or 'live recording'.
Thanks for your answers. Its immensely helpful.
Warm Regards
Ashwini
Hi Honglei,
Thanks again for your answers. Can you please look at MATLAB example : AudioArrayDOAEstimationExample.m
In that case recorded audio is from "Microsoft Kinect" microphones array and its output is a single ".wav" file with four channels as four columns of the matrices (after we perform the step function).
In that case Direction of Arrival (DOA) estimation is done correctly to an extent.
If I have the similar kind of '.wav' file (say from Kinect microphone), can we not perform the Beamforming using that '.wav' file or 'live recording'.
Thanks for your answers. Its immensely helpful.
Warm Regards Ashwini
The important thing is to have signal from individual channels, if your wav file contains that information, then yes it can be used. Does your file contain such data?

Sign in to comment.

HI Honglei,
Also regarding "Live Recording" and using it for Beamforming, how can I get the Handle to the connected Microphone Array and use it as input to the "phased.FrostBeamformer" (parameter : SensorArray) ?
One way is to a) Create "phased.OmnidirectionalMicrophoneElement" and pass that to "phased.ULA". But the issue is, microphone Element spacing is very specific in my case.
Is there a way to directly pass the connected Microphone Array to Beamformer ?
Warm Regards Ashwini

1 Comment

You just need to construct the array according to your real parameter. The geometry information is used in the beamformer. HTH

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!