• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

schroederreverbmatlab实现

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

原理参考:Natural sounding artificial reverberation

 

combFilter.m:

function output = combFilter(delay, gain, input)

fs = 48000;

delaySample = int32(delayTime * fs / 1000);

B = [1 zeros(1, delaySample - 1)];

A=[1 zeros(1, delaySample - 2) -gain];

output = filter(B, A, input);

end

 

calcCombGain.m:

function gain = calcCombGain(reverbTime, delayTime)

gain = power(10, -3 * delayTime / reverbTime)

end

 

 

allPassFilter.m:

function output = allPassFilter(delay, gain, input)

fs = 48000;

delaySample = int32(delayTime * fs / 1000);

B = [-gain zeros(1, delaySample - 2) 1];

A=[1 zeros(1, delaySample - 2) -gain];

output = filter(B, A, input);

end

 

reverb.m:

function output = reverb(combDelayTime, combGain, allPassDelayTime, allPassGain, input)

y = zeros(length(input), 4);

combOut = zeros(length(input), 1);

for i = 1:1:4

y(:, i) = combFilter(combDelayTime(i), combGain(i), input);

combOut = combOut + y(:, i);

end

allPassOut1 = allPassFilter(allPassDelayTime(1), allPassGain(1), combOut);

output = allPassFilter(allPassDelayTime(2), allPassGain(2), allPassOut1);

output = output * 0.25 + input;

end

 

main.m:

clc

clear

T60 = 2000;

combDelayTime = [29.23 37.67 41.49 44.31];

combGain = calcCombGain(T60, combDelayTime);

allPassDelayTime = [5 1.7];

allPassGain = [0.7 0.7];

%input = [1, zeros(48000-1, 1)];

[input fs] = wavread('test.wav');

y = reverb(combDelayTime, combGain, allPassDelayTime, allPassGain, input);

wavwrite(y, fs, 'reverb.wav');

figure(1)

plot(y)


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
matlab编程如何换行发布时间:2022-07-18
下一篇:
Delphi中使用IdHTTP访问基于SSL协议(https)的网站发布时间:2022-07-18
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap