Csound Csound-dev Csound-tekno Search About

EQ Filter Orc/Sco

Date1998-11-14 23:14
FromHans Mikelson
SubjectEQ Filter Orc/Sco
Hi,

Here is an implementation of a parametric equalizer based on the following
paper:

The Equivalence of Various Methods of Computing Biquad Coefficients for
Audio Parametric Equalizers by Robert Bristow-Johnson

available from the web site:

http://www.harmony-central.com/Effects/Articles/EQ_Coefficients/

For some reason I seem to have to multiply the center frequency by about 6.5
to get it correct.  Anyone see what I am doing wrong?

Bye,
Hans Mikelson

; ORCHESTRA
;----------------------------------------------------------------
; Biquadratic Equalizer Filter
; Coded by Hans Mikelson November 1998
;----------------------------------------------------------------
sr=44100
kr=4410
ksmps=10
nchnls=2

;----------------------------------------------------------------
; 1 Band Parametric Equalizer
;----------------------------------------------------------------
        instr 1

ifc     =     p4      ; Center Frequency
ibw     =     p5      ; Band Width in Octaves
igain   =     p6      ; Gain/Cut in dB

iomega0 =     2*taninv(ifc*6.5/2/sr)  ; I seem to have to multiply by 6.5 to
get Fc correct?
igamma  =     sinh(log(2)/2*ibw*iomega0/sin(iomega0))*sin(iomega0) ; Gamma
as defined in the paper
ik      =     ampdb(igain)              ; Convert dB to Amplitude

igrtk   =     igamma*sqrt(ik)           ; Calculate in advance
igortk  =     igamma/sqrt(ik)           ; to save time

kb0     =     1+igrtk                   ; Compute the coefficients
kb1     =    -2*cos(iomega0)
kb2     =     1-igrtk
ka0     =     1+igortk
ka1     =     kb1
ka2     =     1-igortk

asig    rand  10000                    ; Random number source for testing

aout    biquad asig, kb0, kb1, kb2, ka0, ka1, ka2  ; Biquad filter

        outs   aout, aout              ; Output the results

endin

; SCORE
;  Sta  Dur  Fcenter  BandWidth(Octaves)  Boost/Cut(dB)
i1 0    1    1000     .5                   12
i1 +    .    5000     .5                   12
i1 .    .    5000     .2                   12
i1 .    .    1000     .5                  -12
i1 .    .    5000     .5                  -12
i1 .    .    5000     1                   -12

Date1998-11-15 12:58
FromMike McHugh
SubjectRe: EQ Filter Orc/Sco

>
>For some reason I seem to have to multiply the center frequency by about 6.5
>to get it correct.  Anyone see what I am doing wrong?


This number is close to 2 times pi.  Maybe the input needs to
be in radians, so you need to multiply by 2 pi (6.28) ?


Mike



-----------------------------------------------------------------------
 "Faith and trust can win the day, despite all your losing" -Led Zeppelin

                http://www.novasonix.com