- Timestamp:
- Oct 15, 2009, 6:54:23 PM (15 years ago)
- 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
- Location:
- python
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/aubioclass.py
rcd77c15 rfe163ad 125 125 126 126 class pitchdetection: 127 def __init__(self,mode= aubio_pitch_mcomb,bufsize=2048,hopsize=1024,128 channels=1,samplerate=44100.,omode= aubio_pitchm_freq,tolerance=0.1):129 self.pitchp = new_aubio_pitchdetection( bufsize,hopsize,channels,130 samplerate,mode,omode)127 def __init__(self,mode="mcomb",bufsize=2048,hopsize=1024, 128 channels=1,samplerate=44100.,omode="freq",tolerance=0.1): 129 self.pitchp = new_aubio_pitchdetection(mode,bufsize,hopsize,channels, 130 samplerate) 131 131 self.mypitch = fvec(1, channels) 132 aubio_pitchdetection_set_unit(self.pitchp,omode) 132 133 aubio_pitchdetection_set_tolerance(self.pitchp,tolerance) 133 134 #self.filt = filter(srate,"adsgn") -
python/aubio/task/params.py
rcd77c15 rfe163ad 1 from aubio.aubioclass import aubio_pitchm_freq2 1 3 2 class taskparams(object): … … 30 29 self.pitchdelay = -0.5 31 30 self.dcthreshold = -1. 32 self.omode = aubio_pitchm_freq31 self.omode = "freq" 33 32 self.verbose = False 34 33 -
python/aubio/task/pitch.py
rcd77c15 rfe163ad 14 14 else: 15 15 tolerance = 0. 16 self.pitchdet = pitchdetection(mode= get_pitch_mode(self.params.pitchmode),16 self.pitchdet = pitchdetection(mode=self.params.pitchmode, 17 17 bufsize=self.params.bufsize, 18 18 hopsize=self.params.hopsize, -
python/aubio/task/utils.py
rcd77c15 rfe163ad 26 26 sys.exit(1) 27 27 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_mcomb32 elif nvalue == 'yin' :33 return aubio_pitch_yin34 elif nvalue == 'fcomb' :35 return aubio_pitch_fcomb36 elif nvalue == 'schmitt':37 return aubio_pitch_schmitt38 elif nvalue == 'yinfft':39 return aubio_pitch_yinfft40 else:41 import sys42 print "error: unknown pitch detection function selected"43 sys.exit(1)44 45 28 def check_onset_mode(option, opt, value, parser): 46 29 """ wrapper function to convert a list of modes to … … 59 42 val.append(get_pitch_mode(nvalue)) 60 43 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 sys75 print "error: unknown pitch detection output selected"76 sys.exit(1)77 78 -
python/aubiopitch
rcd77c15 rfe163ad 18 18 help="input sound file") 19 19 parser.add_option("-m","--mode", 20 action="store", dest="mode", default=' mcomb',20 action="store", dest="mode", default='yinfft', 21 21 help="pitch detection mode [default=mcomb] \ 22 22 mcomb|yin|fcomb|schmitt") 23 parser.add_option("-u","--units", action="callback", 24 callback=check_pitchm_mode, dest="omode", 25 default=aubio_pitchm_freq, 23 parser.add_option("-u","--units", 24 action="store", dest="omode", default="freq", 26 25 help="output pitch in units [default=Hz] \ 27 26 freq|midi|cent|bin") … … 78 77 (options, args) = parser.parse_args() 79 78 if not options.bufsize: 80 if options.mode == aubio_pitch_yin: options.bufsize = 102481 if options.mode == aubio_pitch_schmitt: options.bufsize = 204882 if options.mode == aubio_pitch_mcomb: options.bufsize = 409683 if options.mode == aubio_pitch_fcomb: options.bufsize = 409679 if options.mode == "yin": options.bufsize = 1024 80 if options.mode == "schmitt": options.bufsize = 2048 81 if options.mode == "mcomb": options.bufsize = 4096 82 if options.mode == "fcomb": options.bufsize = 4096 84 83 else: options.bufsize = 2048 85 84 if not options.hopsize: … … 106 105 if options.pitchmax: params.pitchmax = int(options.pitchmax) 107 106 if options.pitchmin: params.pitchmin = int(options.pitchmin) 108 if options.omode: params.omode = int(options.omode)109 107 #mintol = float(options.mintol)*step 110 108 # default take back system delay
Note: See TracChangeset
for help on using the changeset viewer.