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);
 
