Acoustic Beamforming in microphone arrays

조회 수: 14 (최근 30일)
Ali Movahed
Ali Movahed 2017년 1월 19일
Hello everyone, I want to localize sources with microphone Arrays and beamforming algorithms. To do this, Setting weighting factors are important for me. here is my code:
% Define my microphone array
h = phased.ConformalArray();
t= 1/2*(1+sqrt(5));
n=16;
c= ones(n,1)';
c(:)=1:16;
h.ElementPosition = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;(sqrt(c).*cos(2*pi*t*c))*0.0375;(sqrt(c).*sin(2*pi*t*c))*0.0375];
h.ElementNormal = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0];
h.Element = ...
phased.OmnidirectionalMicrophoneElement('BackBaffled',true,'FrequencyRange',[48e3 580e3]);
% Define my Signal
t = 0:0.001:0.3; % Time, sampling frequency is 1kHz
s = zeros(size(t));
s = s(:); % Signal in column vector
s(201:205) = s(201:205) + 1; % Define the pulse
carrierFreq = 10e4;
wavelength = physconst('LightSpeed')/carrierFreq;
inputAngle = [45; 0];
x = collectPlaneWave(h,s,inputAngle,carrierFreq);
% Define the MVDR beamformer
mvdrbeamformer = phased.MVDRBeamformer('SensorArray',h,...
'Direction',inputAngle,'OperatingFrequency',carrierFreq,...
'WeightsOutputPort',true);
% Pattern
plotResponse(h,10e4,physconst('LightSpeed'),'Format','line',...
'RespCut','az','Unit','db','NormalizeResponse',false);
I want to set These weights : [yCbf,w] = step(mvdrbeamformer,x); but I am not sure how to put them in plotResponse function. Could anyone help me with this?
  댓글 수: 1
Nick Yiw
Nick Yiw 2019년 3월 18일
Hi, I am a student currently working on a project that involves distance speech recognition for controlling output. I really want to know what are the best recommendations of microphone arrays/chips that I can use which are compatible with MATLAB. Thank you.

댓글을 달려면 로그인하십시오.

답변 (3개)

Honglei Chen
Honglei Chen 2017년 1월 19일
To get the weights, you can do
[y,w] = step(mvdrbeamformer,x);
Then to plot the pattern, you can pass w as 'Weights' into plotResponse
plotResponse(h,10e4,physconst('LightSpeed'),'Format','line',...
'RespCut','az','Unit','db','NormalizeResponse',false,'Weights',w);
HTH
  댓글 수: 2
Ali Movahed
Ali Movahed 2017년 1월 20일
Thank you for your Response. Actually I did the same Thing but again I get an error: Warning: Matrix is singular to working precision. > In lcmvweights>qrlinsolve at 97 In lcmvweights at 69 In MVDRBeamformer>MVDRBeamformer.stepImpl at 243 In Newbeamforming at 26 Warning: Matrix is singular to working precision. > In lcmvweights>qrlinsolve at 98 In lcmvweights at 69 In MVDRBeamformer>MVDRBeamformer.stepImpl at 243 In Newbeamforming at 26 Error using plotResponse Expected Weights to be non-NaN.
Error in phased.internal.plotRadiationPattern (line 172) validateattributes(weights,{'numeric'},{'nonnan','finite',...
Error in phased.internal.AbstractArray/plotResponse (line 217) phased.internal.plotRadiationPattern(...
Error in Newbeamforming (line 27) plotResponse(h,10e4,physconst('LightSpeed'),'Format','line',...
The calculated values in Matrix x are all Zero and I think the weights are not calculated in the code. I dont know why the values of Weighting factor are calculated in Nan!
Honglei Chen
Honglei Chen 2017년 1월 26일
I took a deeper look. The signal are actually not all zeros, but has some info in it. However, the pulse is rather short, that's why you see a lot of zeros. But that's not why the script fails provide more meaningful information. The two most critical issue I think are
1. The propagation speed is set to speed of light. Since you say it's a microphone array, I assume it should be speed of sound in air? So I modified the following two lines
pspeed = 343;
x = collectPlaneWave(h,s,inputAngle,carrierFreq,pspeed);
mvdrbeamformer = phased.MVDRBeamformer('SensorArray',h,...
'Direction',inputAngle,'OperatingFrequency',carrierFreq,...
'WeightsOutputPort',true,'PropagationSpeed',pspeed)
2. The collectPlaneWave does not add any noise yet if there is no noise, MVDR cannot work properly. that's why you see the singular matrix warning. You can add noise by doing
x = collectPlaneWave(h,s,inputAngle,carrierFreq,pspeed);
x = x+0.01/sqrt(2)*(randn(size(x))+1i*randn(size(x)));
It may not be the right amount of noise you want but that's the idea.
This would make the script work. But the result isn't great because at 100 kHz, the wavelength is about 3 mm. However the spacing between elements are much larger, this can cause grating lobe issues.
In addition, if possible, it would be better to feed the MVDR algorithm a noise only signal to estimate a better covariance. The way to do it is to turn on the training signal input, as shown below.
xt = 0.01/sqrt(2)*(randn(size(x))+1i*randn(size(x)));
% Define the MVDR beamformer
mvdrbeamformer = phased.MVDRBeamformer('SensorArray',h,...
'Direction',inputAngle,'OperatingFrequency',carrierFreq,...
'WeightsOutputPort',true,'PropagationSpeed',pspeed,...
'TrainingInputPort',true);
[y,w] = step(mvdrbeamformer,x,xt);
I do see better result when I turn on the training signal.
HTH

댓글을 달려면 로그인하십시오.


Zeynep Ertekin
Zeynep Ertekin 2017년 1월 22일
Hi,
I need a 2d or 3d sound source localization code with command load; can anyone please help me. Any help will be highly apprecited.

Juan Diego Archila Quintero
Juan Diego Archila Quintero 2022년 5월 22일
hello I need a code in matlab to locate sound source

Community Treasure Hunt

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

Start Hunting!

Translated by