【问题标题】:Low Pass Ideal Filter implementing using matlab 2014a使用 matlab 2014a 实现的低通理想滤波器
【发布时间】:2015-02-02 13:24:49
【问题描述】:

在这里我必须发出声音信号 - 一个是男性语音信号,另一个是噪音信号 - 我已经将它们加在一起 ​​- 称之为信号“混合” - 现在我被要求过滤它以便噪音被删除,剩下的只有男性语音信号。 在分析男性语音和噪声的时域和频域图后

时域 1: https://www.dropbox.com/s/m5frew6f0qlbae5/filteres%20signal.jpg?dl=0

频域

我观察到男性语音的最大频率略低于噪声的最小频率,因此我制作了一个低通滤波器 - 使用 rect 函数 - 并在频域中对其进行滤波。

理想的低通滤波器

我在频域和时域都绘制了结果信号,频域图与频域男性语音图相同,但时域不完全相同

过滤信号

当我听到结果信号时,我也注意到了这种变化。 有什么帮助请知道为什么过滤后的信号与原始男性语音不完全一样?

*P.S:我知道以这种方式过滤是不够的,但目前我们应该在我的课程报告中这样做。

这是我的代码:

[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)

【问题讨论】:

  • 图片不显示。可能最好检查超链接。
  • 当我点击链接时出现以下消息:“错误 (403)。看来你不属于这里!你应该登录。查看我们的帮助中心和论坛寻求帮助,或者回家吧。”
  • 已确认。链接已失效。
  • 将图片下载到您的计算机上,然后在编辑问题时使用上传图片功能。
  • @AMH9,链接因权限问题而失效。在 Dropbox 中,您必须为要与其他用户共享的图片创建“链接”。

标签: matlab signals filtering bandwidth


【解决方案1】:

这里有一个提示 - 一个理想的过滤器可以实现吗?理想低通滤波器的傅立叶逆变换是什么?自从我看过这些东西以来已经有一段时间了,但我认为您没有遇到错误。相反,您会看到过滤器设计过于僵化的效果。

【讨论】:

  • 我的理想滤波器的傅立叶逆变换应该是时域的 sinc 函数,对吧?
  • 是的,我想是的。因此,如果您乘以频域中的理想滤波器,它如何转化为时域?
  • 嗯,我认为在时域中,我将不得不在滤波器 - sinc 函数 - 与信号之间进行卷积,但由于 sinc 函数在 matlab 中无法实现,因为它趋于无穷大,matlab 将其删除默认情况下,我认为有几种类型的窗口 - rect .. kaiser 等 - 以达到最完美的过滤器。
  • 我确实理解在时域 - 窗口 - 和频域中进行滤波的区别,我只是认为这个低通滤波器有问题,可以做得更好。感谢您的时间和澄清。
  • 我的观点是,如果您在频域中使用理想的低通滤波器,您最终会拖尾信号并导致“振铃”,因为正如您所指出的,sinc 函数会继续无穷大并且不会很快衰减。 Please read the answer here.
猜你喜欢
  • 2013-10-31
  • 1970-01-01
  • 2017-04-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-05-03
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多