Changeset 7473074


Ignore:
Timestamp:
Dec 16, 2005, 2:21:17 AM (19 years ago)
Author:
Paul Brossier <piem@altern.org>
Branches:
feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
Children:
257debc
Parents:
61680aa
Message:

separate get_onset_mode
separate get_onset_mode

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/tasks.py

    r61680aa r7473074  
    11from aubioclass import *
    22
     3def get_onset_mode(nvalue):
     4        """ utility function to convert a string to aubio_onsetdetection_type """
     5        if   nvalue == 'complexdomain' or nvalue == 'complex' :
     6                 return aubio_onset_complex
     7        elif nvalue == 'hfc'           :
     8                 return aubio_onset_hfc
     9        elif nvalue == 'phase'         :
     10                 return aubio_onset_phase
     11        elif nvalue == 'specdiff'      :
     12                 return aubio_onset_specdiff
     13        elif nvalue == 'energy'        :
     14                 return aubio_onset_energy
     15        elif nvalue == 'kl'            :
     16                 return aubio_onset_kl
     17        elif nvalue == 'mkl'           :
     18                 return aubio_onset_mkl
     19        elif nvalue == 'dual'          :
     20                 return 'dual'
     21        else:
     22                 import sys
     23                 print "unknown onset detection function selected"
     24                 sys.exit(1)
     25
    326def check_onset_mode(option, opt, value, parser):
    4         """ utility function to convert a string to aubio_onsetdetection_type """
     27        """ wrapper function to convert a list of modes to
     28                aubio_onsetdetection_type """
    529        nvalues = parser.rargs[0].split(',')
    630        val =  []
    731        for nvalue in nvalues:
    8                 if   nvalue == 'complexdomain' or nvalue == 'complex' :
    9                          val.append(aubio_onset_complex)
    10                 elif nvalue == 'hfc'           :
    11                          val.append(aubio_onset_hfc)
    12                 elif nvalue == 'phase'         :
    13                          val.append(aubio_onset_phase)
    14                 elif nvalue == 'specdiff'      :
    15                          val.append(aubio_onset_specdiff)
    16                 elif nvalue == 'energy'        :
    17                          val.append(aubio_onset_energy)
    18                 elif nvalue == 'kl'            :
    19                          val.append(aubio_onset_kl)
    20                 elif nvalue == 'mkl'           :
    21                          val.append(aubio_onset_mkl)
    22                 elif nvalue == 'dual'          :
    23                          val.append('dual')
    24                 else:
    25                          import sys
    26                          print "unknown onset detection function selected"
    27                          sys.exit(1)
     32                val.append(get_onset_mode(nvalue))
    2833                setattr(parser.values, option.dest, val)
    2934
Note: See TracChangeset for help on using the changeset viewer.