::  
::  
::  > > I think this should be a seperate utility outside of lame?  Most people
::  > > encode from CDs, which usually are already correctly filtered for stuff
::  > > below 20 Hz.
::  > >
::  > For pop music this is (mostly) true. I will test several CDs. Next week.
::  > The psycho part I would nevertheless filter with a 8rd order Chebychew
::  > high pass @80 Hz. Remember active controlled boxes by B&O. But also
::  > normal vented tubes have a relatively sharp cut off at low frequencies,
::  > so don't rely on masking.
::  > 
::  
::  The windowed FFT used for the psycho acoustics surely has better
::  frequency responce than an 8th order Chebychev filter, 
::  so there will negligable leakage of this 80Hz tone into
::  other frequencies.  If you think this is a problem, I would
::  try some experiemnts by removing (from the psycho acoustics)
::  the coefficients up to 80hz.  
::  
1. Chebychev filters (LTI system) have no leakage at all
2. Chebychev highpass filters (like all IIR filters) have a worse 
   frequency resolution for high frequencies ( -> oo) and a extremly
   good for low frequencies ( -> 0).
3. You can program a FFT like filterbank with simple 2nd order
   lowpass filters. But this filterbank has problems with
   detecting high frequencies if there are high level low
   frequency signals are present.

Calculate yourself:

#include <stdio.h>
#include <math.h>

#define PASS_BAND_RIPPLE    0.1     // dB
#define ORDER               8
#define STOP_BAND           84.22   // Hz, note damping is not 
                                    // -3 dB, but -PASS_BAND_RIPPLE dB

double cheychev_polynom ( double x, int n )
{
    // NOTE: These are really polynoms, but the trigonometric
    //       represenation is much easier to remember
    
    if ( x <= 1 )
        return cos  ( n*acos  (x) );
    else
        return cosh ( n*acosh (x) );   // would be the same formula for complex numbers
}

int  step ( int i )
{
    if ( i <   200 ) return     1;
    if ( i <   500 ) return     2;
    if ( i <  1000 ) return    10;
    if ( i <  2000 ) return    50;
    if ( i <  5000 ) return   200;
    if ( i < 10000 ) return  1000;
    if ( i < 25000 ) return  5000;
    return i;
}

int main (void)
{
    int     i;
    double  poly;
    double  damp;
    double  ripple = pow ( 10., 0.1*PASS_BAND_RIPPLE ) - 1.;
    
    for ( i = 1; i <= 20000; i += step (i) ) {
        poly = cheychev_polynom ( (double) STOP_BAND / i, ORDER );
        damp = 10. * log10 ( 1. + ripple * poly * poly ) 
             + ( ORDER & 1  ?  0.  :  -PASS_BAND_RIPPLE );
        printf ( "%5u Hz%9.2f dB\n", i, -damp );
    }
    return 0;
}

-- 
Mit freundlichen Grüßen
Frank Klemm
 
eMail | [EMAIL PROTECTED]       home: [EMAIL PROTECTED]
phone | +49 (3641) 64-2721    home: +49 (3641) 390545
sMail | R.-Breitscheid-Str. 43, 07747 Jena, Germany

--
MP3 ENCODER mailing list ( http://geek.rcc.se/mp3encoder/ )

Reply via email to