wah-wah filter


digital audio effects page 67 

%% wah-wah filters
clc; close all; clear;
fs = 44.1e3;
fc = 10e3;
Wc = fc / fs;
fb = 1e2;
Wb = fb / fs;
num = 5e4;
f0 = 3;
t = (0:num-1) / fs;
t = t(:);
f = (0:num-1) / num * fs;
f = f(:);
x = randn(num, 1);
xh = [0 0];
fcc = fc;
fca = 5e3;
y = zeros(size(x));
mix = 0.01;
for n = 1:length(x)
    fc = 1e4 + fca * cos( 2 * pi * f0 * t(n));
    Wc = fc / fs;
    d = -cos( 2 * pi * Wc);
    c = (tan(pi *Wb) - 1) / (tan(pi *Wb) + 1);
    xh_new = x(n) -d * (1 - c) * xh(1) + c * xh(2);
    ap_y = -c*xh_new + d * (1 - c) * xh(1) + xh(2); % allpass filter
    xh = [xh_new xh(1)];
    ap = 0.5 * ( x(n) - ap_y);      % bandpass 
    y(n) = mix*x(n) + (1 - mix)*ap;   
end


figure;
spectrogram(y, 128, [], [], fs);    
sound(y, fs);

The result is depicted in the following figure.


a similar approach can be found at http://web.uvic.ca/~cjam/ELEC484/Assignment%203/Part%201/wahwah2.m



  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值