Acoustic Beamforming using Microphone Array : Recorded Multi Channel Audio
조회 수: 6 (최근 30일)
이전 댓글 표시
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
Angelica Londono Borja
2021년 4월 24일
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.
답변 (2개)
Honglei Chen
2015년 10월 8일
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
Honglei Chen
2015년 10월 15일
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?
Ashwini Srivastava
2015년 10월 9일
댓글 수: 1
Honglei Chen
2015년 10월 15일
You just need to construct the array according to your real parameter. The geometry information is used in the beamformer. HTH
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!