Matlab中的编码噪声消除

问题描述 投票:0回答:1

这是我在网上找到的程序。应该从文件夹中取出一个音频文件,添加噪音然后过滤掉。但是,ha = dsp.LMSFilter(256,mu);是错误的,以及如何向dsp.LMSFilter()添加正确的参数,我不知道。阿洛斯,我不了解代码的运作方式。任何帮助,将不胜感激。这是我学院一项非常重要且分级的项目的一部分。

load handel.mat;
d= 'Recording.m4a';
samples = [1,20*Fs];
clear d Fs
[d,Fs] = audioread('Recording.m4a',samples);
sound(d,Fs)
pause(3)
x=awgn(d,20);
sound(x,Fs) 
pause(3)
mu=0.017;%stepsize
ha=dsp.LMSFilter(256,mu); 
[y,e]=filter(ha,x(:,1),d(:,1));
sound(y,Fs)
subplot(4,1,1),plot(d)
grid on
xlabel('iterations')
ylabel('amplitude')
title('original voice signal')
subplot(4,1,2)
plot(x)
grid on
xlabel('iterations')
ylabel('amplitude')
title('signal with AWGN')
subplot(4,1,3)
plot(y)
grid on
title('filtered output')
xlabel('iterations')
ylabel('amplitude')
subplot(4,1,4)
plot(e)
grid on
title('error signal')
xlabel('iterations')
ylabel('amplitude')
matlab noise cancellation
1个回答
0
投票

我尝试了您的代码并收到此错误。

  Error using
  matlab.system.SystemProp/parseInputs
  dsp.LMSFilter System object constructor
  supports only 1 value-only inputs. You have
  specified 2 value-only inputs. A common cause
  of this error is misspelling a property name.

  Error in
  matlab.system.SystemProp/setProperties

  Error in dsp.LMSFilter

  Error in SO (line 12)
  ha=dsp.LMSFilter(256,mu);

这意味着您将在LMSFilter函数中提供一个额外的参数。而您从互联网复制的代码可能是这样的

 ha=adaptfilt.lms(256,mu);

这里adaptfilt可能具有接受两个参数的lms函数

© www.soinside.com 2019 - 2024. All rights reserved.