rceps matlab,Real cepstrum and minimum-phase reconstruction

A speech recording includes an echo caused by reflection off a wall. Use the real cepstrum to filter it out.

In the recording, a person says the word MATLAB®. Load the data and the sample rate, Fs=7418Hz.

load mtlb

% To hear, type soundsc(mtlb,Fs)

Model the echo by adding to the recording a copy of the signal delayed by Δ samples and attenuated by a known factor α: y(n)=x(n)+αx(n-Δ). Specify a time lag of 0.23 s and an attenuation factor of 0.5.

timelag = 0.23;

delta = round(Fs*timelag);

alpha = 0.5;

orig = [mtlb;zeros(delta,1)];

echo = [zeros(delta,1);mtlb]*alpha;

mtEcho = orig + echo;

Plot the original, the echo, and the resulting signal.

t = (0:length(mtEcho)-1)/Fs;

subplot(2,1,1)

plot(t,[orig echo])

legend('Original','Echo')

subplot(2,1,2)

plot(t,mtEcho)

legend('Total')

xlabel('Time (s)')

b36036aa6e15b702e4dc9dbef25f961a.png

% To hear, type soundsc(mtEcho,Fs)

Compute the real cepstrum of the signal. Plot the cepstrum and annotate its maxima. The cepstrum has a sharp peak at the time at which the echo starts to arrive.

c = rceps(mtEcho);

[px,locs] = findpeaks(c,'Threshold',0.2,'MinPeakDistance',0.2);

clf

plot(t,c,t(locs),px,'o')

xlabel('Time (s)')

789df4c3da58fbd6160e5066dc52b87c.png

Cancel the echo by filtering the signal through an IIR system whose output, w, obeys w(n)+αw(n-Δ)=y(n). Plot the filtered signal and compare it to the original.

dl = locs(2)-1;

mtNew = filter(1,[1 zeros(1,dl-1) alpha],mtEcho);

subplot(2,1,1)

plot(t,orig)

legend('Original')

subplot(2,1,2)

plot(t,mtNew)

legend('Filtered')

xlabel('Time (s)')

35dcc18f862c9b6c9673291e02ab87cc.png

% To hear, type soundsc(mtNew,Fs)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值