资源简介
等边三角形麦克风阵列语音增强的程序,采用延时求和波束形成的方法,同时实现声源定位功能。
代码片段和文件信息
%等边三角形阵列语音增强和声源定位
load far_signal_whole.mat;
load far_signal_whole.mat;
m=min(length(far_signal_whole)length(far_signal_whole));
N1=1;%20000;
N2=m;%N1+3000;
s1=far_signal_whole(N1:N2); % Adjust the power of far_signal_whole
s2=far_signal_whole(N1:N2);
s1=(s1-min(s1))/(max(s1)-min(s1));
s2=(s2-min(s2))/(max(s2)-min(s2));
fs=16000;
N=8;
auwrite(s1fsN‘s1‘);
auwrite(s2fsN‘s2‘);
s1=1.3*s1;
Enegy1=0;
Enegy2=0;
for k=1:length(s1)
Enegy1=Enegy1+s1(k)^2;
Enegy2=Enegy2+s2(k)^2;
end
Ratio=Enegy1/Enegy2;
S1=fft(s1);
S2=fft(s2);
sita1=-pi/3; % the angle of the first source. range: from -pi/2 to pi/2
sita2=pi/3; % the angle of the second source. range: from -pi/2 to pi/2
r1=1.0; % the radius of the first sound source
r2=1.0; % the radius of the second sound source
Nfft=length(S1);
D=0.433; % distance between two microphones suppose the diameter of circle is 0.5.
V=344.21; %23 degrees % velocity of sounds
fs=1.6e4; % the sampling frequency
Nbeg=0.5;
Nend=1.5;
No=11;
%******************************************
% Variants for Reverberation/混响/
%******************************************
T60=0.4; % time for degrading up to 60db; seen [1]
L=0.5*T60*fs; % length of filter for reverberation
% Mixed sound signals in near--field equation
d11=sqrt(D*D/4+r1*r1+D*r1*sin(sita1));
d12=sqrt(3*D*D/4+r1*r1-sqrt(3)*D*r1*cos(sita1));
d13=sqrt(D*D/4+r1*r1-D*r1*sin(sita1));
d21=sqrt(D*D/4+r2*r2+D*r2*sin(sita2));
d22=sqrt(3*D*D/4+r2*r2-sqrt(3)*D*r2*cos(sita2));
d23=sqrt(D*D/4+r2*r2-D*r2*sin(sita2));
for f=1:Nfft
X1(f)=exp(-i*2*pi*f/Nfft*d11*fs/V)*d11/d11*S1(f)+exp(-i*2*pi*f/Nfft*d21*fs/V)*d21/d21*S2(f);
X2(f)=exp(-i*2*pi*f/Nfft*d12*fs/V)*d11/d12*S1(f)+exp(-i*2*pi*f/Nfft*d22*fs/V)*d21/d22*S2(f);
X3(f)=exp(-i*2*pi*f/Nfft*d13*fs/V)*d11/d13*S1(f)+exp(-i*2*pi*f/Nfft*d23*fs/V)*d21/d23*S2(f);
end
mid_mix1=real(ifft(X1));
mid_mix2=real(ifft(X2));
mid_mix3=real(ifft(X3));
%*********Add reverberation***************
%*********Impulse Response[2]*************
% % addtional noise: 40dB
% save(‘X1‘‘X1‘);
% save(‘X2‘‘X2‘);
% save(‘X3‘‘X3‘);
% load X1;
X1=awgn(X120);
% load X2;
X2=awgn(X220);
% load X3;
X3=awgn(X320);
mixed1=real(ifft(X1));
mixed2=real(ifft(X2));
mixed3=real(ifft(X3));
mixed1=(mixed1-min(mixed1))/(max(mixed1)-min(mixed1))-0.6;
mixed2=(mixed2-min(mixed2))/(max(mixed2)-min(mixed2))-0.43;
mixed3=(mixed3-min(mixed3))/(max(mixed3)-min(mixed3));
figure;
subplot(311);
plot(mixed1‘-r‘);
xlabel(‘signal points‘)
ylabel(‘Amplitude‘)
title(‘Mixed signal1‘)
subplot(312);
plot(mixed2‘-r‘);
xlabel(‘signal points‘)
ylabel(‘Amplitude‘)
title(‘Mixed signal2‘)
subplot(313);
plot(mixed3‘-r‘);
xlabel(‘signal points‘)
ylabel(‘Amplitude‘)
title(‘Mixed signal3‘)
%DSBF
B1=0;
L=zeros(19
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 7568 2013-06-19 19:27 DS_Beamforming.m
----------- --------- ---------- ----- ----
7568 1
评论
共有 条评论