2014-12-04 160 views
1

这里我必须发出声音信号 - 一个是男性语音信号,另一个是噪声信号,我已经将它们加在一起 ​​- 称之为信号“混合” - 现在,米要求过滤它,以便消除噪音,剩下的只是男性的语音信号。 https://www.dropbox.com/s/m5frew6f0qlbae5/filteres%20signal.jpg?dl=0低通理想滤波器实现使用matlab 2014a

enter image description here

频域

enter image description here

我观察到: 分析男性语音和噪声的曲线图在时间和频率域

时域1后那个男性语音的最大频率略小于噪声的最小频率,所以我制作了低通滤波器 - 使用矩形函数 - 并在频域进行滤波。

理想的低通滤波器

enter image description here

我绘制在频率和时域上的最终得到的信号,在频域的曲线是相同的频域,但在时间上的男性语音图表域名是不完全一样的

滤波信号

enter image description here 我注意到了这个变化,当我发出了结果信号。 任何帮助,请知道为什么过滤后的信号不完全像原来的男性讲话?我知道用这种方式过滤是不够的,但目前我们应该在我们的课程报告中这样做。

这里是我的代码:

[voice,Fs] = audioread ('hamid1.wav'); 
[noise,Fs] = audioread ('noise.wav'); 
voice(55126: 131072)=0 % to add both voice and noise signal together their dimensio must agree 
mix = voice + noise; % the mixed signal 

%vp = audioplayer(voice,Fs); 
%play(vp); 
%-- data for plotting voice --% 
iFs = 1/Fs; 
voiceLen = length(voice); 
voiceF0 = 1/(iFs*voiceLen); 
f_voice = 0:voiceF0: (voiceLen-1)*voiceF0; 
t_voice = 0:iFs:(voiceLen-1)*iFs; 
mag_voice = abs(fft(voice)); 

%-- data for plotting noise --% 
noiseLen = length(noise); 
noiseF0 = 1/(iFs*noiseLen); 
f_noise = 0:noiseF0: (noiseLen-1)*noiseF0; 
t_noise = 0:iFs:(noiseLen-1)/Fs; 
mag_noise = abs(fft(noise)); 
%--------------------------------------------% 

%-- data for plotting mix --% 
mixLen = length(mix); 
mixF0 = 1/(iFs*mixLen); 
f_mix= 0:mixF0: (mixLen-1)*mixF0; 
t_mix = 0:iFs:(mixLen-1)/Fs; 
mag_mix = abs(fft(mix)); 

%-- plotting voice speech, noise and mix in frequency domain --% 
figure(1); 
subplot(3,1,1); 
plot(f_voice,mag_voice); 
title('voice speech in frequency domain'); 
xlabel('frequency'); ylabel('Magnitude'); 
subplot(3,1,2); 
plot(f_noise,mag_noise); 
title('noise in frequency domain'); 
xlabel('frequency'); ylabel('Magnitude'); 
subplot(3,1,3); 
plot(f_mix,mag_mix); 
title('mix signal in frequency domain'); 
xlabel('frequency'); ylabel('Magnitude') 

%-- plotting voice speech, noise and mix in time domain --% 
figure(2); 
subplot(3,1,1); 
plot(t_voice,voice); 
title('voice speech in time domain'); 
xlabel('time'); ylabel('Amplitude'); 
subplot(3,1,2); 
plot(t_noise,noise); 
title('noise in time domain'); 
xlabel('time'); ylabel('Amplitude'); 
subplot(3,1,3); 
plot(t_mix, mix); 
title('mix signal in time domain'); 
xlabel('time'); ylabel('Amplitude') 

%-- design the bandpass filter -- 
rect = 1*(f_mix>=0 & f_mix <3000); 
rect2= rect+0*(f_mix>=3000 & f_mix <5482); 
%-- plotting the ideal filter --% 
figure(3) 
plot(f_mix, rect2,'linewidth',2); 
title('bandpass ideal filter'); 
xlabel('frequency'); ylabel('Magnitude') 
axis([0 11000 0 1.5]) 

%-- Filtering the mix signal to extract voice speech without noise --% 
filtered = rect2.*mag_mix' 
filteredT = ifft(filtered) 

figure(4) 
subplot(2,1,1) 
plot(f_mix, filtered) 
title('Filtered signal in frequency domain') 
xlabel('frequency') 
ylabel('Magnitude') 

subplot(2,1,2) 
plot(t_mix, real(filteredT)) 
title('Filtered signal in time domain') 
xlabel('time') 
ylabel('Amplitude') 
%-------------------------------------------% 
filtSig = audioplayer(filteredT,Fs) 
play(filtSig) 
+0

图片不显示。可能最好检查超链接。 – am304 2014-12-04 15:37:03

+0

@ am304我已经添加了图片的链接,我希望它现在会显示 – AMH9 2014-12-04 15:47:08

+1

当我在链接上点击时出现以下消息:“Error(403)。 看起来你不属于这里!你应该登录。查看我们的帮助中心和论坛寻求帮助,或者回到家中。“ – am304 2014-12-04 15:53:18

回答

2

这里有一个提示 - 是一种理想的过滤器实现的?理想低通滤波器的逆傅里叶变换是什么?自从我看过这些东西已经有一段时间了,但我认为你没有收到任何错误。相反,您会看到过滤器设计过于严格的影响。

+0

我的理想滤波器的逆傅立叶变换将是时域中的sinc函数,对吗? – AMH9 2014-12-04 19:40:10

+0

是的,我认为是。因此,如果您在频域中乘以理想的滤波器,那么这是如何转化为时域的? – RGHummel 2014-12-04 19:42:41

+0

嗯我觉得在时间域中,我将不得不在滤波器 - sinc函数与信号之间进行卷积运算,但由于sinc函数在matlab中无法实现,因为matlab会进入无穷大,所以默认情况下,matlab会将其切断。是几种类型的窗口 - 矩形..凯泽等。 - 达到最完美的过滤器。 – AMH9 2014-12-04 19:50:03