- added
git-svn-id: http://moon:8086/svn/matlab/trunk@128 801c6759-fa7c-4059-a304-17956f83a07c
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
function [Bp,Ap] = boost3a(fs, fc, bw, gain, P);
|
||||
%BOOST - Design a boost filter at given gain, center
|
||||
% frequency fc, bandwidth bw, and sampling rate fs
|
||||
% (default = 1).
|
||||
%
|
||||
% Cookbook formulae for audio EQ biquad filter coefficients
|
||||
% by Robert Bristow-Johnson <rbj@audioimagination.com>
|
||||
|
||||
Q = bw/fs;
|
||||
|
||||
Bp = zeros(P, 3);
|
||||
Ap = zeros(P, 3);
|
||||
for p=1:P,
|
||||
kp = IIRCalcQp(p, P);
|
||||
[Bp(p,:),Ap(p,:)] = peaking(fs, fc, kp*Q, gain);
|
||||
endfor
|
||||
|
||||
B = Bp(1,:);
|
||||
A = Ap(1,:);
|
||||
if nargout==0
|
||||
close
|
||||
freqz(B,A);
|
||||
title('Boost Frequency Response')
|
||||
end
|
||||
|
||||
endfunction
|
||||
|
||||
function [B,A] = peaking(fs, fc, Q, K)
|
||||
k1=-cos(2*pi*fc/fs);
|
||||
k2=(1-tan(Q/2))/(1+tan(Q/2));
|
||||
Pz = [1 k1*(1+k2) k2]; % define denominator coefficients
|
||||
Qz = [k2 k1*(1+k2) 1]; % define numerator coefficients
|
||||
Num = (Pz*(1+K) + Qz*(1-K))/2;
|
||||
Den = Pz;
|
||||
B = Num;
|
||||
A = Den;
|
||||
|
||||
endfunction
|
||||
|
||||
function kp = IIRCalcQp(p, P)
|
||||
kp = 1.0/(2*sin(pi*(2*p-1)/(2*P)));
|
||||
|
||||
endfunction
|
||||
Reference in New Issue
Block a user