Acoustic Beamforming using Microphone Array : Recorded Multi Channel Audio

18 visualizzazioni (ultimi 30 giorni)
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 Commento
Angelica Londono Borja
Angelica Londono Borja il 24 Apr 2021
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.

Accedi per commentare.

Risposte (2)

Honglei Chen
Honglei Chen il 8 Ott 2015
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 Commenti
Ashwini Srivastava
Ashwini Srivastava il 9 Ott 2015
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
Honglei Chen
Honglei Chen il 15 Ott 2015
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?

Accedi per commentare.


Ashwini Srivastava
Ashwini Srivastava il 9 Ott 2015
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 Commento
Honglei Chen
Honglei Chen il 15 Ott 2015
You just need to construct the array according to your real parameter. The geometry information is used in the beamformer. HTH

Accedi per commentare.

Community Treasure Hunt

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

Start Hunting!

Translated by