Acoustic Beamforming in microphone arrays
14 views (last 30 days)
Show older comments
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 Comment
Nick Yiw
on 18 Mar 2019
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.
Answers (3)
Honglei Chen
on 19 Jan 2017
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 Comments
Honglei Chen
on 26 Jan 2017
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
on 22 Jan 2017
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.
0 Comments
Juan Diego Archila Quintero
on 22 May 2022
hello I need a code in matlab to locate sound source
0 Comments
See Also
Categories
Find more on Antennas, Microphones, and Sonar Transducers in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!