Changeset fe163ad for python/aubio/task


Ignore:
Timestamp:
Oct 15, 2009, 6:54:23 PM (15 years ago)
Author:
Paul Brossier <piem@piem.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:
515c7b2
Parents:
cd77c15
Message:

src/pitch: use a string to set pitch method, add a new function to set pitch unit, keep pitch enums private, update pitch methods where they are used

Location:
python/aubio/task
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/task/params.py

    rcd77c15 rfe163ad  
    1 from aubio.aubioclass import aubio_pitchm_freq
    21
    32class taskparams(object):
     
    3029                self.pitchdelay = -0.5
    3130                self.dcthreshold = -1.
    32                 self.omode = aubio_pitchm_freq
     31                self.omode = "freq"
    3332                self.verbose   = False
    3433
  • python/aubio/task/pitch.py

    rcd77c15 rfe163ad  
    1414                else:
    1515                        tolerance = 0.
    16                 self.pitchdet   = pitchdetection(mode=get_pitch_mode(self.params.pitchmode),
     16                self.pitchdet   = pitchdetection(mode=self.params.pitchmode,
    1717                        bufsize=self.params.bufsize,
    1818                        hopsize=self.params.hopsize,
  • python/aubio/task/utils.py

    rcd77c15 rfe163ad  
    2626                 sys.exit(1)
    2727
    28 def get_pitch_mode(nvalue):
    29         """ utility function to convert a string to aubio_pitchdetection_type """
    30         if   nvalue == 'mcomb'  :
    31                  return aubio_pitch_mcomb
    32         elif nvalue == 'yin'    :
    33                  return aubio_pitch_yin
    34         elif nvalue == 'fcomb'  :
    35                  return aubio_pitch_fcomb
    36         elif nvalue == 'schmitt':
    37                  return aubio_pitch_schmitt
    38         elif nvalue == 'yinfft':
    39                  return aubio_pitch_yinfft
    40         else:
    41                  import sys
    42                  print "error: unknown pitch detection function selected"
    43                  sys.exit(1)
    44 
    4528def check_onset_mode(option, opt, value, parser):
    4629        """ wrapper function to convert a list of modes to
     
    5942                val.append(get_pitch_mode(nvalue))
    6043                setattr(parser.values, option.dest, val)
    61 
    62 def check_pitchm_mode(option, opt, value, parser):
    63         """ utility function to convert a string to aubio_pitchdetection_mode """
    64         nvalue = parser.rargs[0]
    65         if   nvalue == 'freq'  :
    66                  setattr(parser.values, option.dest, aubio_pitchm_freq)
    67         elif nvalue == 'midi'  :
    68                  setattr(parser.values, option.dest, aubio_pitchm_midi)
    69         elif nvalue == 'cent'  :
    70                  setattr(parser.values, option.dest, aubio_pitchm_cent)
    71         elif nvalue == 'bin'   :
    72                  setattr(parser.values, option.dest, aubio_pitchm_bin)
    73         else:
    74                  import sys
    75                  print "error: unknown pitch detection output selected"
    76                  sys.exit(1)
    77 
    78 
Note: See TracChangeset for help on using the changeset viewer.