Index: examples/aubiotrack.c
===================================================================
--- examples/aubiotrack.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ examples/aubiotrack.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -81,5 +81,5 @@
 
   out = new_fvec(2,channels);
-  bt  = new_aubio_tempo(type_onset,buffer_size,overlap_size,channels);
+  bt  = new_aubio_tempo(onset_mode,buffer_size,overlap_size,channels);
 
   examples_common_process(aubio_process,process_print);
Index: examples/utils.c
===================================================================
--- examples/utils.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ examples/utils.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -46,6 +46,5 @@
 
 /* energy,specdiff,hfc,complexdomain,phase */
-aubio_onsetdetection_type type_onset = aubio_onset_kl;
-aubio_onsetdetection_type type_onset2 = aubio_onset_complex;
+char_t * onset_mode = "default";
 smpl_t threshold = 0.3;
 smpl_t silence = -90.;
@@ -92,5 +91,4 @@
 
 /* badly redeclare some things */
-aubio_onsetdetection_type type_onset;
 smpl_t threshold;
 smpl_t averaging;
@@ -164,27 +162,5 @@
         break;
       case 'O':                /*onset type */
-        if (strcmp (optarg, "energy") == 0)
-          type_onset = aubio_onset_energy;
-        else if (strcmp (optarg, "specdiff") == 0)
-          type_onset = aubio_onset_specdiff;
-        else if (strcmp (optarg, "hfc") == 0)
-          type_onset = aubio_onset_hfc;
-        else if (strcmp (optarg, "complexdomain") == 0)
-          type_onset = aubio_onset_complex;
-        else if (strcmp (optarg, "complex") == 0)
-          type_onset = aubio_onset_complex;
-        else if (strcmp (optarg, "phase") == 0)
-          type_onset = aubio_onset_phase;
-        else if (strcmp (optarg, "mkl") == 0)
-          type_onset = aubio_onset_mkl;
-        else if (strcmp (optarg, "kl") == 0)
-          type_onset = aubio_onset_kl;
-        else if (strcmp (optarg, "specflux") == 0)
-          type_onset = aubio_onset_specflux;
-        else {
-          errmsg ("unknown onset type.\n");
-          abort ();
-        }
-        usedoubled = 0;
+        onset_mode = optarg;
         break;
       case 's':                /* threshold value for onset */
@@ -332,10 +308,6 @@
   /* onsets */
   parms = new_aubio_peakpicker (threshold);
-  o = new_aubio_onsetdetection (type_onset, buffer_size, channels);
+  o = new_aubio_onsetdetection (onset_mode, buffer_size, channels);
   onset = new_fvec (1, channels);
-  if (usedoubled) {
-    o2 = new_aubio_onsetdetection (type_onset2, buffer_size, channels);
-    onset2 = new_fvec (1, channels);
-  }
 
 }
Index: examples/utils.h
===================================================================
--- examples/utils.h	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ examples/utils.h	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -79,6 +79,5 @@
 
 /* energy,specdiff,hfc,complexdomain,phase */
-extern aubio_onsetdetection_type type_onset;
-extern aubio_onsetdetection_type type_onset2;
+extern char_t * onset_mode;
 extern smpl_t threshold;
 extern smpl_t silence;
Index: plugins/puredata/aubioonset~.c
===================================================================
--- plugins/puredata/aubioonset~.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ plugins/puredata/aubioonset~.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -88,5 +88,5 @@
 	x->hopsize   = x->bufsize / 2;
 
-	x->o = new_aubio_onsetdetection(aubio_onset_complex, x->bufsize, 1);
+	x->o = new_aubio_onsetdetection("complex", x->bufsize, 1);
 	x->vec = (fvec_t *)new_fvec(x->hopsize,1);
 	x->pv = (aubio_pvoc_t *)new_aubio_pvoc(x->bufsize, x->hopsize, 1);
Index: plugins/puredata/aubiotempo~.c
===================================================================
--- plugins/puredata/aubiotempo~.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ plugins/puredata/aubiotempo~.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -83,5 +83,5 @@
   x->hopsize   = x->bufsize / 2;
 
-  x->t = new_aubio_tempo (aubio_onset_complex, x->bufsize, x->hopsize, 1);
+  x->t = new_aubio_tempo ("complex", x->bufsize, x->hopsize, 1);
   aubio_tempo_set_silence(x->t,x->silence);
   aubio_tempo_set_threshold(x->t,x->threshold);
Index: python/aubio/aubioclass.py
===================================================================
--- python/aubio/aubioclass.py	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ python/aubio/aubioclass.py	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -70,6 +70,6 @@
 class onsetdetection:
     """ class for aubio_onsetdetection """
-    def __init__(self,type,buf,chan):
-        self.od = new_aubio_onsetdetection(type,buf,chan)
+    def __init__(self,mode,buf,chan):
+        self.od = new_aubio_onsetdetection(mode,buf,chan)
     def do(self,tc,tf):
         aubio_onsetdetection_do(self.od,tc(),tf())
@@ -94,6 +94,6 @@
         self.pv       = pvoc(bufsize,hopsize,channels)
         if mode in ['dual'] :
-                self.myod     = onsetdetection(aubio_onset_hfc,bufsize,channels)
-                self.myod2    = onsetdetection(aubio_onset_mkl,bufsize,channels)
+                self.myod     = onsetdetection("hfc",bufsize,channels)
+                self.myod2    = onsetdetection("mkl",bufsize,channels)
                 self.myonset  = fvec(1,channels)
                 self.myonset2 = fvec(1,channels)
Index: src/onset/onset.c
===================================================================
--- src/onset/onset.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ src/onset/onset.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -89,5 +89,5 @@
 
 /* Allocate memory for an onset detection */
-aubio_onset_t * new_aubio_onset (aubio_onsetdetection_type type_onset, 
+aubio_onset_t * new_aubio_onset (char_t * onset_mode, 
     uint_t buf_size, uint_t hop_size, uint_t channels)
 {
@@ -100,9 +100,9 @@
   o->pv = new_aubio_pvoc(buf_size, hop_size, channels);
   o->pp = new_aubio_peakpicker(o->threshold);
-  o->od = new_aubio_onsetdetection(type_onset,buf_size,channels);
+  o->od = new_aubio_onsetdetection(onset_mode,buf_size,channels);
   o->fftgrain = new_cvec(buf_size,channels);
   o->of = new_fvec(1, channels);
   /*if (usedoubled)    {
-    o2 = new_aubio_onsetdetection(type_onset2,buffer_size,channels);
+    o2 = new_aubio_onsetdetection(onset_type2,buffer_size,channels);
     onset2 = new_fvec(1 , channels);
   }*/
Index: src/onset/onset.h
===================================================================
--- src/onset/onset.h	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ src/onset/onset.h	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -52,5 +52,5 @@
 
 */
-aubio_onset_t * new_aubio_onset (aubio_onsetdetection_type type_onset, 
+aubio_onset_t * new_aubio_onset (char_t * onset_mode, 
     uint_t buf_size, uint_t hop_size, uint_t channels);
 
Index: src/onset/onsetdetection.c
===================================================================
--- src/onset/onsetdetection.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ src/onset/onsetdetection.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -124,7 +124,19 @@
 void aubio_onsetdetection_specflux(aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
 
+/** onsetdetection types */
+typedef enum {
+        aubio_onset_energy,         /**< energy based */          
+        aubio_onset_specdiff,       /**< spectral diff */         
+        aubio_onset_hfc,            /**< high frequency content */
+        aubio_onset_complex,        /**< complex domain */        
+        aubio_onset_phase,          /**< phase fast */            
+        aubio_onset_kl,             /**< Kullback Liebler */
+        aubio_onset_mkl,            /**< modified Kullback Liebler */
+        aubio_onset_specflux,       /**< spectral flux */
+} aubio_onsetdetection_type;
+
 /** structure to store object state */
 struct _aubio_onsetdetection_t {
-  aubio_onsetdetection_type type; /**< onset detection type */
+  aubio_onsetdetection_type onset_type; /**< onset detection type */
   /** Pointer to aubio_onsetdetection_<type> function */
   void (*funcpointer)(aubio_onsetdetection_t *o,
@@ -305,9 +317,32 @@
  */
 aubio_onsetdetection_t * 
-new_aubio_onsetdetection (aubio_onsetdetection_type type, 
+new_aubio_onsetdetection (char_t * onset_mode, 
     uint_t size, uint_t channels){
   aubio_onsetdetection_t * o = AUBIO_NEW(aubio_onsetdetection_t);
   uint_t rsize = size/2+1;
-  switch(type) {
+  aubio_onsetdetection_type onset_type;
+  if (strcmp (onset_mode, "energy") == 0)
+      onset_type = aubio_onset_energy;
+  else if (strcmp (onset_mode, "specdiff") == 0)
+      onset_type = aubio_onset_specdiff;
+  else if (strcmp (onset_mode, "hfc") == 0)
+      onset_type = aubio_onset_hfc;
+  else if (strcmp (onset_mode, "complexdomain") == 0)
+      onset_type = aubio_onset_complex;
+  else if (strcmp (onset_mode, "complex") == 0)
+      onset_type = aubio_onset_complex;
+  else if (strcmp (onset_mode, "phase") == 0)
+      onset_type = aubio_onset_phase;
+  else if (strcmp (onset_mode, "mkl") == 0)
+      onset_type = aubio_onset_mkl;
+  else if (strcmp (onset_mode, "kl") == 0)
+      onset_type = aubio_onset_kl;
+  else if (strcmp (onset_mode, "specflux") == 0)
+      onset_type = aubio_onset_specflux;
+  else {
+      AUBIO_ERR("unknown onset type.\n");
+      return NULL;
+  }
+  switch(onset_type) {
     /* for both energy and hfc, only fftgrain->norm is required */
     case aubio_onset_energy: 
@@ -348,5 +383,5 @@
    * above and always allocate all the structure */
 
-  switch(type) {
+  switch(onset_type) {
     case aubio_onset_energy:
       o->funcpointer = aubio_onsetdetection_energy;
@@ -376,10 +411,10 @@
       break;
   }
-  o->type = type;
+  o->onset_type = onset_type;
   return o;
 }
 
 void del_aubio_onsetdetection (aubio_onsetdetection_t *o){
-  switch(o->type) {
+  switch(o->onset_type) {
     /* for both energy and hfc, only fftgrain->norm is required */
     case aubio_onset_energy: 
Index: src/onset/onsetdetection.h
===================================================================
--- src/onset/onsetdetection.h	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ src/onset/onsetdetection.h	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -39,16 +39,4 @@
 #endif
 
-/** onsetdetection types */
-typedef enum {
-        aubio_onset_energy,         /**< energy based */          
-        aubio_onset_specdiff,       /**< spectral diff */         
-        aubio_onset_hfc,            /**< high frequency content */
-        aubio_onset_complex,        /**< complex domain */        
-        aubio_onset_phase,          /**< phase fast */            
-        aubio_onset_kl,             /**< Kullback Liebler */
-        aubio_onset_mkl,            /**< modified Kullback Liebler */
-        aubio_onset_specflux,       /**< spectral flux */
-} aubio_onsetdetection_type;
-
 /** onsetdetection structure */
 typedef struct _aubio_onsetdetection_t aubio_onsetdetection_t;
@@ -70,5 +58,5 @@
 
 */
-aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels);
+aubio_onsetdetection_t * new_aubio_onsetdetection(char_t * onset_mode, uint_t buf_size, uint_t channels);
 /** deletion of an onset detection object
 
Index: src/tempo/tempo.c
===================================================================
--- src/tempo/tempo.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ src/tempo/tempo.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -99,5 +99,5 @@
 
 /* Allocate memory for an tempo detection */
-aubio_tempo_t * new_aubio_tempo (aubio_onsetdetection_type type_onset, 
+aubio_tempo_t * new_aubio_tempo (char_t * onset_mode, 
     uint_t buf_size, uint_t hop_size, uint_t channels)
 {
@@ -114,5 +114,5 @@
   o->pv       = new_aubio_pvoc(buf_size, hop_size, channels);
   o->pp       = new_aubio_peakpicker(o->threshold);
-  o->od       = new_aubio_onsetdetection(type_onset,buf_size,channels);
+  o->od       = new_aubio_onsetdetection(onset_mode,buf_size,channels);
   o->of       = new_fvec(1, channels);
   o->bt       = new_aubio_beattracking(o->winlen,channels);
Index: src/tempo/tempo.h
===================================================================
--- src/tempo/tempo.h	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ src/tempo/tempo.h	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -38,5 +38,5 @@
 
 /** create tempo detection object */
-aubio_tempo_t * new_aubio_tempo (aubio_onsetdetection_type type_onset, 
+aubio_tempo_t * new_aubio_tempo (char_t * mode, 
     uint_t buf_size, uint_t hop_size, uint_t channels);
 
Index: swig/aubio.i
===================================================================
--- swig/aubio.i	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ swig/aubio.i	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -188,15 +188,5 @@
 
 /* onset detection */
-typedef enum { 
-        aubio_onset_energy, 
-        aubio_onset_specdiff, 
-        aubio_onset_hfc, 
-        aubio_onset_complex, 
-        aubio_onset_phase, 
-        aubio_onset_kl, 
-        aubio_onset_mkl, 
-        aubio_onset_specflux,
-} aubio_onsetdetection_type;
-aubio_onsetdetection_t * new_aubio_onsetdetection(aubio_onsetdetection_type type, uint_t size, uint_t channels);
+aubio_onsetdetection_t * new_aubio_onsetdetection(char * onset_mode, uint_t size, uint_t channels);
 void aubio_onsetdetection_do (aubio_onsetdetection_t *o, cvec_t * fftgrain, fvec_t * onset);
 void del_aubio_onsetdetection(aubio_onsetdetection_t *o);
Index: tests/src/test-onset.c
===================================================================
--- tests/src/test-onset.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ tests/src/test-onset.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -7,5 +7,5 @@
         fvec_t * in       = new_fvec (win_s/4, channels); /* input buffer */
         fvec_t * out      = new_fvec (2, channels);     /* input buffer */
-        aubio_onset_t * onset  = new_aubio_onset(aubio_onset_complex, win_s, win_s/4, channels);
+        aubio_onset_t * onset  = new_aubio_onset("complex", win_s, win_s/4, channels);
         uint_t i = 0;
 
Index: tests/src/test-onsetdetection.c
===================================================================
--- tests/src/test-onsetdetection.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ tests/src/test-onsetdetection.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -12,29 +12,29 @@
   aubio_onsetdetection_t *o;
   
-  o = new_aubio_onsetdetection (aubio_onset_energy, win_s, channels);
+  o = new_aubio_onsetdetection ("energy", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
 
-  o = new_aubio_onsetdetection (aubio_onset_specdiff, win_s, channels);
+  o = new_aubio_onsetdetection ("energy", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
 
-  o = new_aubio_onsetdetection (aubio_onset_hfc, win_s, channels);
+  o = new_aubio_onsetdetection ("hfc", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
 
-  o = new_aubio_onsetdetection (aubio_onset_complex, win_s, channels);
+  o = new_aubio_onsetdetection ("complex", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
 
-  o = new_aubio_onsetdetection (aubio_onset_phase, win_s, channels);
+  o = new_aubio_onsetdetection ("phase", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
 
-  o = new_aubio_onsetdetection (aubio_onset_kl, win_s, channels);
+  o = new_aubio_onsetdetection ("kl", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
 
-  o = new_aubio_onsetdetection (aubio_onset_mkl, win_s, channels);
+  o = new_aubio_onsetdetection ("mkl", win_s, channels);
   aubio_onsetdetection_do (o, in, out);
   del_aubio_onsetdetection (o);
Index: tests/src/test-tempo.c
===================================================================
--- tests/src/test-tempo.c	(revision 27fa522078b15ed1000feda7a97103cba8b48bbc)
+++ tests/src/test-tempo.c	(revision b4f5967809d2ebb0a69d303048017cfad34927ac)
@@ -8,5 +8,5 @@
         fvec_t * in       = new_fvec (win_s, channels); /* input buffer */
         fvec_t * out      = new_fvec (2, channels);     /* input buffer */
-        aubio_tempo_t * o  = new_aubio_tempo(aubio_onset_complex, win_s, win_s/4, channels);
+        aubio_tempo_t * o  = new_aubio_tempo("complex", win_s, win_s/4, channels);
         uint_t i = 0;
 
