博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
schroeder reverb matlab实现
阅读量:7177 次
发布时间:2019-06-29

本文共 1459 字,大约阅读时间需要 4 分钟。

原理参考:

 

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)

转载于:https://www.cnblogs.com/fellow1988/p/9801393.html

你可能感兴趣的文章
SQL 脚本收录
查看>>
PYTHON1.面向对象_day01
查看>>
Centos7下python3.7的pipSSLError问题
查看>>
typedef
查看>>
PC端网页嵌入百度地图
查看>>
数组中的对象排序
查看>>
【转】 当程序崩溃的时候怎么办 part-1
查看>>
小象机器学习(邹博老师)学习笔记
查看>>
发现js端日期跟php端日期格式不一致
查看>>
Codeforces Round #321 (Div. 2) Kefa and First Steps 模拟
查看>>
四则运算栈实现,支持小数、负数
查看>>
判断链表是否有交点若有找出交点
查看>>
优秀的IT网站
查看>>
PrintWriter与ServletOutputStream的区别之文件下载
查看>>
取消IE“已限制此网页运行可以访问计算机的脚本“
查看>>
21. Merge Two Sorted Lists
查看>>
六月心情
查看>>
【转】linux中do{...} while(0)的解释
查看>>
HDU-2059 龟兔赛跑 动态规划
查看>>
〖Linux〗clang3.4的编译与安装
查看>>