Index: src/spectral/filterbank_mel.c
===================================================================
--- src/spectral/filterbank_mel.c	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/spectral/filterbank_mel.c	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -28,5 +28,5 @@
 uint_t
 aubio_filterbank_set_triangle_bands (aubio_filterbank_t * fb,
-    smpl_t samplerate, fvec_t * freqs)
+    fvec_t * freqs, smpl_t samplerate)
 {
 
@@ -191,5 +191,5 @@
 
   /* now compute the actual coefficients */
-  retval = aubio_filterbank_set_triangle_bands (fb, samplerate, freqs);
+  retval = aubio_filterbank_set_triangle_bands (fb, freqs, samplerate);
 
   /* destroy vector used to store frequency limits */
Index: src/spectral/filterbank_mel.h
===================================================================
--- src/spectral/filterbank_mel.h	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/spectral/filterbank_mel.h	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -51,5 +51,5 @@
 */
 uint_t aubio_filterbank_set_triangle_bands (aubio_filterbank_t * fb,
-    smpl_t samplerate, fvec_t * freqs);
+    fvec_t * freqs, smpl_t samplerate);
 
 /** filterbank initialization for Mel filters using Slaney's coefficients
Index: src/temporal/a_weighting.c
===================================================================
--- src/temporal/a_weighting.c	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/temporal/a_weighting.c	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -1,4 +1,3 @@
 /*
-
   Copyright (C) 2003-2009 Paul Brossier <piem@aubio.org>
 
@@ -27,7 +26,8 @@
 #include "temporal/a_weighting.h"
 
-uint_t aubio_filter_set_a_weighting (aubio_filter_t * f) {
-
-  uint_t samplerate = aubio_filter_get_samplerate (f);
+uint_t
+aubio_filter_set_a_weighting (aubio_filter_t * f, uint_t samplerate)
+{
+  aubio_filter_set_samplerate (f, samplerate);
   lvec_t *bs = aubio_filter_get_feedforward (f);
   lvec_t *as = aubio_filter_get_feedback (f);
@@ -35,13 +35,12 @@
   uint_t order = aubio_filter_get_order (f);
 
-  if ( order != 7 ) {
-    AUBIO_ERROR ( "order of A-weighting filter must be 7, not %d\n", order );
+  if (order != 7) {
+    AUBIO_ERROR ("order of A-weighting filter must be 7, not %d\n", order);
     return 1;
   }
 
   /* select coefficients according to sampling frequency */
-  switch ( samplerate ) {
-
-    // adsgn 8000
+  switch (samplerate) {
+
     case 8000:
       b[0] =  6.306209468238731519207362907764036208391189575195312500e-01;
@@ -61,5 +60,4 @@
       break;
 
-    // adsgn 11025
     case 11025:
       b[0] =  6.014684165832374640459079273568931967020034790039062500e-01;
@@ -79,5 +77,4 @@
       break;
 
-    // adsgn 16000
     case 16000:
       b[0] =  5.314898298235570806014038680586963891983032226562500000e-01;
@@ -97,5 +94,4 @@
       break;
 
-    // adsgn 22050
     case 22050:
       b[0] =  4.492998504299193784916610638902056962251663208007812500e-01;
@@ -115,5 +111,4 @@
       break;
 
-    // adsgn 24000
     case 24000:
       b[0] =  4.256263892891054001488271296693710610270500183105468750e-01;
@@ -133,5 +128,4 @@
       break;
 
-    // adsgn 32000
     case 32000:
       b[0] =  3.434583386824304196416335344110848382115364074707031250e-01;
@@ -151,5 +145,4 @@
       break;
 
-    // adsgn 44100
     case 44100:
       b[0] =  2.557411252042575133813784304948057979345321655273437500e-01;
@@ -169,5 +162,4 @@
       break;
 
-    // adsgn 48000
     case 48000:
       b[0] =  2.343017922995132285013397677175817079842090606689453125e-01;
@@ -187,5 +179,4 @@
       break;
 
-    // adsgn 88200
     case 88200:
       b[0] =  1.118876366882113199130444058937428053468465805053710938e-01;
@@ -205,5 +196,4 @@
       break;
 
-    // adsgn 96000
     case 96000:
       b[0] =  9.951898975972744976203898659150581806898117065429687500e-02;
@@ -223,5 +213,4 @@
       break;
 
-    // adsgn 192000
     case 192000:
       b[0] =  3.433213424548713782469278044118254911154508590698242188e-02;
@@ -241,8 +230,7 @@
       break;
 
-    default: 
-      AUBIO_ERROR ( "sampling rate of A-weighting filter is %d, should be one of\
- 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 192000.\n", 
- samplerate );
+    default:
+      AUBIO_ERROR ("sampling rate of A-weighting filter is %d, should be one of\
+ 8000, 11025, 16000, 22050, 24000, 32000, 44100, 48000, 88200, 96000, 192000.\n", samplerate);
       return 1;
 
@@ -252,8 +240,9 @@
 }
 
-aubio_filter_t * new_aubio_filter_a_weighting (uint_t samplerate, uint_t channels) {
-  aubio_filter_t * f = new_aubio_filter (samplerate, 7, channels);
-  aubio_filter_set_a_weighting (f);
+aubio_filter_t *
+new_aubio_filter_a_weighting (uint_t channels, uint_t samplerate)
+{
+  aubio_filter_t *f = new_aubio_filter (7, channels);
+  aubio_filter_set_a_weighting (f, samplerate);
   return f;
 }
-
Index: src/temporal/a_weighting.h
===================================================================
--- src/temporal/a_weighting.h	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/temporal/a_weighting.h	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -69,5 +69,6 @@
 
 */
-aubio_filter_t * new_aubio_filter_a_weighting (uint_t samplerate, uint_t channels);
+aubio_filter_t *new_aubio_filter_a_weighting (uint_t channels,
+    uint_t samplerate);
 
 /** set feedback and feedforward coefficients of a A-weighting filter
@@ -76,5 +77,5 @@
 
 */
-uint_t aubio_filter_set_a_weighting (aubio_filter_t *f);
+uint_t aubio_filter_set_a_weighting (aubio_filter_t *f, uint_t samplerate);
 
 #ifdef __cplusplus
Index: src/temporal/c_weighting.c
===================================================================
--- src/temporal/c_weighting.c	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/temporal/c_weighting.c	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -26,21 +26,21 @@
 #include "temporal/c_weighting.h"
 
-uint_t aubio_filter_set_c_weighting (aubio_filter_t * f) {
-
-  uint_t samplerate = aubio_filter_get_samplerate (f);
-  lvec_t * bs = aubio_filter_get_feedforward (f);
-  lvec_t * as = aubio_filter_get_feedback (f);
+uint_t
+aubio_filter_set_c_weighting (aubio_filter_t * f, uint_t samplerate)
+{
+  aubio_filter_set_samplerate (f, samplerate);
+  lvec_t *bs = aubio_filter_get_feedforward (f);
+  lvec_t *as = aubio_filter_get_feedback (f);
   lsmp_t *b = bs->data[0], *a = as->data[0];
   uint_t order = aubio_filter_get_order (f);
 
   if ( order != 5 ) {
-    AUBIO_ERROR ( "order of C-weighting filter must be 5, not %d\n", order );
+    AUBIO_ERROR ("order of C-weighting filter must be 5, not %d\n", order);
     return 1;
   }
 
   /* select coefficients according to sampling frequency */
-  switch ( samplerate ) {
-
-    // cdsgn 8000
+  switch (samplerate) {
+
     case 8000:
       b[0] =  6.782173932405135552414776611840352416038513183593750000e-01;
@@ -56,5 +56,4 @@
       break;
 
-    // cdsgn 11025
     case 11025:
       b[0] =  6.002357155402652244546857218665536493062973022460937500e-01;
@@ -70,5 +69,4 @@
       break;
 
-    // cdsgn 16000
     case 16000:
       b[0] =  4.971057193673903418229542694461997598409652709960937500e-01;
@@ -84,5 +82,4 @@
       break;
 
-    // cdsgn 22050
     case 22050:
       b[0] =  4.033381299002754549754001800465630367398262023925781250e-01;
@@ -98,5 +95,4 @@
       break;
 
-    // cdsgn 24000
     case 24000:
       b[0] =  3.786678621924967069745093795063439756631851196289062500e-01;
@@ -112,5 +108,4 @@
       break;
 
-    // cdsgn 32000
     case 32000:
       b[0] =  2.977986488230693340462096330156782642006874084472656250e-01;
@@ -126,5 +121,4 @@
       break;
 
-    // cdsgn 44100
     case 44100:
       b[0] =  2.170085619492190254220531642204150557518005371093750000e-01;
@@ -140,5 +134,4 @@
       break;
 
-    // cdsgn 48000
     case 48000:
       b[0] =  1.978871200263932761398422144338837824761867523193359375e-01;
@@ -154,5 +147,4 @@
       break;
 
-    // cdsgn 88200
     case 88200:
       b[0] =  9.221909851156021020734954163344809785485267639160156250e-02;
@@ -168,5 +160,4 @@
       break;
 
-    // cdsgn 96000
     case 96000:
       b[0] =  8.182864044979756834585771230194950476288795471191406250e-02;
@@ -182,5 +173,4 @@
       break;
 
-    // cdsgn 192000
     case 192000:
       b[0] =  2.784755468532278815940728122768632601946592330932617188e-02;
@@ -207,7 +197,7 @@
 }
 
-aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate, uint_t channels) {
-  aubio_filter_t * f = new_aubio_filter(samplerate, 5, channels);
-  aubio_filter_set_c_weighting (f);
+aubio_filter_t * new_aubio_filter_c_weighting (uint_t channels, uint_t samplerate) {
+  aubio_filter_t * f = new_aubio_filter(5, channels);
+  aubio_filter_set_c_weighting (f, samplerate);
   return f;
 }
Index: src/temporal/c_weighting.h
===================================================================
--- src/temporal/c_weighting.h	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/temporal/c_weighting.h	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -69,5 +69,5 @@
 
 */
-aubio_filter_t * new_aubio_filter_c_weighting (uint_t samplerate, uint_t channels);
+aubio_filter_t * new_aubio_filter_c_weighting (uint_t channels, uint_t samplerate);
 
 /** set feedback and feedforward coefficients of a C-weighting filter
@@ -76,5 +76,5 @@
 
 */
-uint_t aubio_filter_set_c_weighting (aubio_filter_t *f);
+uint_t aubio_filter_set_c_weighting (aubio_filter_t *f, uint_t samplerate);
 
 #ifdef __cplusplus
Index: src/temporal/filter.c
===================================================================
--- src/temporal/filter.c	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/temporal/filter.c	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -138,6 +138,13 @@
 }
 
+uint_t
+aubio_filter_set_samplerate (aubio_filter_t * f, uint_t samplerate)
+{
+  f->samplerate = samplerate;
+  return AUBIO_OK;
+}
+
 aubio_filter_t *
-new_aubio_filter (uint_t samplerate, uint_t order, uint_t channels)
+new_aubio_filter (uint_t order, uint_t channels)
 {
   aubio_filter_t *f = AUBIO_NEW (aubio_filter_t);
@@ -146,5 +153,6 @@
   f->a = new_lvec (order, 1);
   f->b = new_lvec (order, 1);
-  f->samplerate = samplerate;
+  /* by default, samplerate is not set */
+  f->samplerate = 0;
   f->order = order;
   /* set default to identity */
Index: src/temporal/filter.h
===================================================================
--- src/temporal/filter.h	(revision ca1abdd5271f95cfc6949637f31d9347358b246e)
+++ src/temporal/filter.h	(revision 59c046dc1d15355548e24d6e29bae383782e656a)
@@ -131,4 +131,14 @@
 uint_t aubio_filter_get_samplerate (aubio_filter_t * f);
 
+/** get sampling rate of the filter
+
+  \param f filter to get sampling rate from
+  \param samplerate sample rate to set the filter to
+
+  \return the sampling rate of the filter, in Hz
+
+*/
+uint_t aubio_filter_set_samplerate (aubio_filter_t * f, uint_t samplerate);
+
 /** create new filter object
 
@@ -143,6 +153,5 @@
 
 */
-aubio_filter_t *new_aubio_filter (uint_t samplerate, uint_t order,
-    uint_t channels);
+aubio_filter_t *new_aubio_filter (uint_t order, uint_t channels);
 
 /** delete a filter object
