From: Paul Brossier Date: Thu, 1 Oct 2009 22:49:59 +0000 (+0200) Subject: src/temporal/[ac]_weighting.[ch]: add coeffs for 24, 32, 48 and 88.2 kHz X-Git-Tag: bzr2git~234 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=321eb85b895ea9c0a29b550820df9aaf919e06f4;p=aubio.git src/temporal/[ac]_weighting.[ch]: add coeffs for 24, 32, 48 and 88.2 kHz --- diff --git a/src/temporal/a_weighting.c b/src/temporal/a_weighting.c index 6465183f..47af8972 100644 --- a/src/temporal/a_weighting.c +++ b/src/temporal/a_weighting.c @@ -42,6 +42,7 @@ void aubio_filter_set_a_weighting (aubio_filter_t * f) { /* select coefficients according to sampling frequency */ switch ( samplerate ) { + // adsgn 8000 case 8000: b[0] = 6.306209468238731519207362907764036208391189575195312500e-01; b[1] = -1.261241893647746525886077506584115326404571533203125000e+00; @@ -59,6 +60,7 @@ void aubio_filter_set_a_weighting (aubio_filter_t * f) { a[6] = 2.098548546080332977137317129745497368276119232177734375e-01; break; + // adsgn 16000 case 16000: b[0] = 5.314898298235570806014038680586963891983032226562500000e-01; b[1] = -1.062979659647114161202807736117392778396606445312500000e+00; @@ -76,6 +78,7 @@ void aubio_filter_set_a_weighting (aubio_filter_t * f) { a[6] = 1.188781038285612462468421313133148942142724990844726562e-01; break; + // adsgn 22050 case 22050: b[0] = 4.492998504299193784916610638902056962251663208007812500e-01; b[1] = -8.985997008598388680056245902960654348134994506835937500e-01; @@ -93,8 +96,45 @@ void aubio_filter_set_a_weighting (aubio_filter_t * f) { a[6] = 5.631716697383508385410522123493137769401073455810546875e-02; break; + // adsgn 24000 + case 24000: + b[0] = 4.256263892891054001488271296693710610270500183105468750e-01; + b[1] = -8.512527785782106892753517968230880796909332275390625000e-01; + b[2] = -4.256263892891054556599783609271980822086334228515625000e-01; + b[3] = 1.702505557156421378550703593646176159381866455078125000e+00; + b[4] = -4.256263892891054556599783609271980822086334228515625000e-01; + b[5] = -8.512527785782106892753517968230880796909332275390625000e-01; + b[6] = 4.256263892891054001488271296693710610270500183105468750e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -3.325996004241962733516402295208536088466644287109375000e+00; + a[2] = 3.677161079286316969216841243905946612358093261718750000e+00; + a[3] = -1.106476076828482035807610373012721538543701171875000000e+00; + a[4] = -4.726706734908718843257702246773988008499145507812500000e-01; + a[5] = 1.861941760230954034938122276798821985721588134765625000e-01; + a[6] = 4.178771337829546850262119050967157818377017974853515625e-02; + break; + + // adsgn 32000 + case 32000: + b[0] = 3.434583386824304196416335344110848382115364074707031250e-01; + b[1] = -6.869166773648609503055695313378237187862396240234375000e-01; + b[2] = -3.434583386824303641304823031532578170299530029296875000e-01; + b[3] = 1.373833354729721900611139062675647437572479248046875000e+00; + b[4] = -3.434583386824303641304823031532578170299530029296875000e-01; + b[5] = -6.869166773648609503055695313378237187862396240234375000e-01; + b[6] = 3.434583386824304196416335344110848382115364074707031250e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -3.656446043233668063976438133977353572845458984375000000e+00; + a[2] = 4.831468450652579349480220116674900054931640625000000000e+00; + a[3] = -2.557597496581567764195597192156128585338592529296875000e+00; + a[4] = 2.533680394205302666144064005493419244885444641113281250e-01; + a[5] = 1.224430322452567110325105659285327419638633728027343750e-01; + a[6] = 6.764072168342137418572956875095769646577537059783935547e-03; + break; + + // adsgn 44100 case 44100: - b[0] = 2.55741125204257513381378430494805797934532165527343750e-01; + b[0] = 2.557411252042575133813784304948057979345321655273437500e-01; b[1] = -5.114822504085150267627568609896115958690643310546875000e-01; b[2] = -2.557411252042575133813784304948057979345321655273437500e-01; b[3] = 1.022964500817030053525513721979223191738128662109375000e+00; @@ -108,7 +148,45 @@ void aubio_filter_set_a_weighting (aubio_filter_t * f) { a[4] = 1.420842949621876627475103305187076330184936523437500000e+00; a[5] = -1.418254738303044160119270600262098014354705810546875000e-01; a[6] = 4.351177233495117681327801761881346465088427066802978516e-03; + break; + + // adsgn 48000 + case 48000: + b[0] = 2.343017922995132285013397677175817079842090606689453125e-01; + b[1] = -4.686035845990265125138307666929904371500015258789062500e-01; + b[2] = -2.343017922995132007457641520886681973934173583984375000e-01; + b[3] = 9.372071691980530250276615333859808743000030517578125000e-01; + b[4] = -2.343017922995132007457641520886681973934173583984375000e-01; + b[5] = -4.686035845990265125138307666929904371500015258789062500e-01; + b[6] = 2.343017922995132285013397677175817079842090606689453125e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -4.113043408775872045168853219365701079368591308593750000e+00; + a[2] = 6.553121752655050258340452273841947317123413085937500000e+00; + a[3] = -4.990849294163385074796224216697737574577331542968750000e+00; + a[4] = 1.785737302937575599059982778271660208702087402343750000e+00; + a[5] = -2.461905953194876706113802811159985139966011047363281250e-01; + a[6] = 1.122425003323123879339640041052916785702109336853027344e-02; + break; + + // adsgn 88200 + case 88200: + b[0] = 1.118876366882113199130444058937428053468465805053710938e-01; + b[1] = -2.237752733764226120705131961585721001029014587402343750e-01; + b[2] = -1.118876366882113337908322137081995606422424316406250000e-01; + b[3] = 4.475505467528452241410263923171442002058029174804687500e-01; + b[4] = -1.118876366882113337908322137081995606422424316406250000e-01; + b[5] = -2.237752733764226120705131961585721001029014587402343750e-01; + b[6] = 1.118876366882113199130444058937428053468465805053710938e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -4.726938565651158441482948546763509511947631835937500000e+00; + a[2] = 9.076897983832765248735086061060428619384765625000000000e+00; + a[3] = -9.014855113464800950850985827855765819549560546875000000e+00; + a[4] = 4.852772261031594425162438710685819387435913085937500000e+00; + a[5] = -1.333877820398965186043938047077972441911697387695312500e+00; + a[6] = 1.460012549591642450064199465487035922706127166748046875e-01; + break; + // adsgn 96000 case 96000: b[0] = 9.951898975972744976203898659150581806898117065429687500e-02; b[1] = -1.990379795194548995240779731830116361379623413085937500e-01; @@ -126,6 +204,7 @@ void aubio_filter_set_a_weighting (aubio_filter_t * f) { a[6] = 1.740971994228911745583587844521389342844486236572265625e-01; break; + // adsgn 192000 case 192000: b[0] = 3.433213424548713782469278044118254911154508590698242188e-02; b[1] = -6.866426849097426177159775306790834292769432067871093750e-02; diff --git a/src/temporal/a_weighting.h b/src/temporal/a_weighting.h index ed13a80c..3625dcba 100644 --- a/src/temporal/a_weighting.h +++ b/src/temporal/a_weighting.h @@ -46,7 +46,11 @@ The coefficients in this file have been computed using Christophe Couvreur's scripts in octave 3.0 (debian package 1:3.0.5-6+b2 with octave-signal 1.0.9-1+b1 on i386), with
 [b, a] = adsign(1/Fs) 
for various - sampling frequencies. + sampling frequencies (8000, 16000, 22050, 24000, 32000, 44100, 48000, 88200, + 96000, and 192000 Hz). + + The sampling frequency should normally be higher than 20kHz, but most common + file sampling rates have been included for completeness. */ @@ -57,7 +61,7 @@ extern "C" { /** create new A-design filter \param samplerate sampling frequency of the signal to filter. Should be one of - 8000, 16000, 22050, 44100, 96000, 192000. + 8000, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and 192000 Hz \param channels number of channels to allocate \return a new filter object diff --git a/src/temporal/c_weighting.c b/src/temporal/c_weighting.c index 68847638..cee6ae3a 100644 --- a/src/temporal/c_weighting.c +++ b/src/temporal/c_weighting.c @@ -41,6 +41,7 @@ void aubio_filter_set_c_weighting (aubio_filter_t * f) { /* select coefficients according to sampling frequency */ switch ( samplerate ) { + // cdsgn 8000 case 8000: b[0] = 6.782173932405135552414776611840352416038513183593750000e-01; b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; @@ -54,6 +55,7 @@ void aubio_filter_set_c_weighting (aubio_filter_t * f) { a[4] = 4.147270002091348328754349950031610205769538879394531250e-01; break; + // cdsgn 16000 case 16000: b[0] = 4.971057193673903418229542694461997598409652709960937500e-01; b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; @@ -67,6 +69,7 @@ void aubio_filter_set_c_weighting (aubio_filter_t * f) { a[4] = 1.660337524309875301131711466950946487486362457275390625e-01; break; + // cdsgn 22050 case 22050: b[0] = 4.033381299002754549754001800465630367398262023925781250e-01; b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; @@ -80,6 +83,35 @@ void aubio_filter_set_c_weighting (aubio_filter_t * f) { a[4] = 7.171589940116777917022972133054281584918498992919921875e-02; break; + // cdsgn 24000 + case 24000: + b[0] = 3.786678621924967069745093795063439756631851196289062500e-01; + b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[2] = -7.573357243849934139490187590126879513263702392578125000e-01; + b[3] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[4] = 3.786678621924967069745093795063439756631851196289062500e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -1.529945307555420797029910318087786436080932617187500000e+00; + a[2] = 1.283553182116208835061854642844991758465766906738281250e-01; + a[3] = 3.494608072385725350272878131363540887832641601562500000e-01; + a[4] = 5.217291949300089520802359288609295617789030075073242188e-02; + break; + + // cdsgn 32000 + case 32000: + b[0] = 2.977986488230693340462096330156782642006874084472656250e-01; + b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[2] = -5.955972976461386680924192660313565284013748168945312500e-01; + b[3] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[4] = 2.977986488230693340462096330156782642006874084472656250e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -1.812455387128179218336754274787381291389465332031250000e+00; + a[2] = 6.425013281155662614452239722595550119876861572265625000e-01; + a[3] = 1.619857574578579817448087396769551560282707214355468750e-01; + a[4] = 7.987649713547682189807019881300220731645822525024414062e-03; + break; + + // cdsgn 44100 case 44100: b[0] = 2.170085619492190254220531642204150557518005371093750000e-01; b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; @@ -93,6 +125,35 @@ void aubio_filter_set_c_weighting (aubio_filter_t * f) { a[4] = 4.908700174624683852664386307651511742733418941497802734e-03; break; + // cdsgn 48000 + case 48000: + b[0] = 1.978871200263932761398422144338837824761867523193359375e-01; + b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[2] = -3.957742400527865522796844288677675649523735046386718750e-01; + b[3] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[4] = 1.978871200263932761398422144338837824761867523193359375e-01; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -2.219172914052801814932536217384040355682373046875000000e+00; + a[2] = 1.455135878947171557129536267893854528665542602539062500e+00; + a[3] = -2.484960738877830532800317087094299495220184326171875000e-01; + a[4] = 1.253882314727246607977129144728678511455655097961425781e-02; + break; + + // cdsgn 88200 + case 88200: + b[0] = 9.221909851156021020734954163344809785485267639160156250e-02; + b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[2] = -1.844381970231204204146990832668961957097053527832031250e-01; + b[3] = 0.000000000000000000000000000000000000000000000000000000e+00; + b[4] = 9.221909851156021020734954163344809785485267639160156250e-02; + a[0] = 1.000000000000000000000000000000000000000000000000000000e+00; + a[1] = -2.785795902923448696952846148633398115634918212890625000e+00; + a[2] = 2.727736758747444145711824603495188057422637939453125000e+00; + a[3] = -1.097007502819661528548067508381791412830352783203125000e+00; + a[4] = 1.550674356752141103132913713125162757933139801025390625e-01; + break; + + // cdsgn 96000 case 96000: b[0] = 8.182864044979756834585771230194950476288795471191406250e-02; b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; @@ -106,6 +167,7 @@ void aubio_filter_set_c_weighting (aubio_filter_t * f) { a[4] = 1.840048283551226071530493300087982788681983947753906250e-01; break; + // cdsgn 192000 case 192000: b[0] = 2.784755468532278815940728122768632601946592330932617188e-02; b[1] = 0.000000000000000000000000000000000000000000000000000000e+00; diff --git a/src/temporal/c_weighting.h b/src/temporal/c_weighting.h index 6fa5a0a6..a3e738aa 100644 --- a/src/temporal/c_weighting.h +++ b/src/temporal/c_weighting.h @@ -46,7 +46,11 @@ The coefficients in this file have been computed using Christophe Couvreur's scripts in octave 3.0 (debian package 1:3.0.5-6+b2 with octave-signal 1.0.9-1+b1 on i386), with
 [b, a] = cdsign(1/Fs) 
for various - sampling frequencies. + sampling frequencies (8000, 16000, 22050, 24000, 32000, 44100, 48000, 88200, + 96000, and 192000 Hz). + + The sampling frequency should normally be higher than 20kHz, but most common + file sampling rates have been included for completeness. */ @@ -57,7 +61,7 @@ extern "C" { /** create new C-design filter \param samplerate sampling frequency of the signal to filter. Should be one of - 8000, 16000, 22050, 44100, 96000, 192000. + 8000, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, and 192000 Hz \param channels number of channels to allocate \return a new filter object