Hi all. I have been trying to build a wideband beamformer using the Phased array toolbox. I implemented a room impulse response and simulated a [10,10,2.5]m room. I built a N mic array with d distance between each mic situated in the room in a uniform linear array. I then simulated a speaker at a different location in the room, in an angle "theta" with respect to the central mic. I get weird results using phased.TimeDelayLCMVBeamformer. Any tips as for how to tackle the problem and build a good wideband beamformer with resonable beam patterns?
Attached is the code:
clear all close all clc
maxTime=102400; fs=48e3; t1 = 0:1/fs:10; t=t1;
N=9; d=0.05; c=340; freq_range=[10 10e3];
sourceLoc=[8,6,1] dimroom=[10 10 2.5]; T60=0.3;
hmic = phased.OmnidirectionalMicrophoneElement('FrequencyRange',freq_range);
ha = phased.ULA('NumElements',N,'ElementSpacing',d,'Element',hmic);
[xsp,Fssp]=wavread(['training (' int2str(11) ')']);
[xsp]=resample(xsp,fs,Fssp);
xsp=xsp/max(xsp);
xsp=xsp';
% % soundsc(xsp,fs);
maxTime=length(xsp);
b=zeros(N,3); b(1:N,1)=[0:d:d*(N-1)]; micplace=b+repmat([3 3 1], N,1); %Placement of Mics
for I=1:N
h(I,:)=rir_generator(c, fs,micplace(I,:), sourceLoc, dimroom, T60, T60 *fs, 'omnidirectional', -1);%(sv, fs, mic1, loc_s, room, T60, T60 * fs,'omnidirectional', order);
xmic(I,:)=awgn(conv(xsp,h(I,:),'same'),5,'measured');
end
xmic=xmic';
xmic=xmic(1:maxTime,:);
% soundsc(xmic(:,4),fs);
incidentAngle=atan((sourceLoc(1)-micplace(ceil(N/2),1))/(sourceLoc(2)-micplace(ceil(N/2),2)))*180/pi;
incidentAngle=[incidentAngle; 0];
numFilt=1;
hbf = phased.TimeDelayLCMVBeamformer('SensorArray',ha,...
'PropagationSpeed',c,'SampleRate',fs,'FilterLength',numFilt,...
'Direction',incidentAngle,'WeightsOutputPort',true);
hbf.Constraint = kron(eye(numFilt),ones(N,1));
hbf.DesiredResponse = eye(numFilt, 1);
[y,w] = step(hbf,xmic);
soundsc(y,fs);
soundsc(xmic(:,4),fs);
plot(t(1:maxTime),xmic(:,4),'r:',t(1:maxTime),y);
xlabel('Time')
ylabel('Amplitude')
legend('Original','Beamformed');
centerFreq=1000:1000:10e3;
centerFreq=centerFreq';
figure; plotResponse(ha,centerFreq',c,'Weights',w,'OverlayFreq',false);
end
Thanks!
No products are associated with this question.
0 Comments