Csound Csound-dev Csound-tekno Search About

Re: EQ Filter Orc/Sco

Date1998-11-15 12:58
FromRichard Dobson
SubjectRe: EQ Filter Orc/Sco
I haven't studied these (there's a lot of discussion about them on the
music-dsp list, with frequent updates and corrections), but 6.5 looks
dangerously close to 2pi (6.28...). 

BTW, I am always a little nervous about long combinations of multiply
and divide without brackets - I know the precedence rules, but it still
reads confusingly to me!

Richard Dobson


Hans Mikelson wrote:
> 
> 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