- Timestamp:
- May 28, 2005, 5:21:55 AM (20 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:
- 5a1ff62
- Parents:
- f88a326
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubioonset
rf88a326 r946cad3 7 7 usage = "usage: %s [options] soundfile" % sys.argv[0] 8 8 9 def check_mode(option, opt, value, parser): 10 nvalue = parser.rargs[0] 11 if nvalue == 'complexdomain' : 12 setattr(parser.values, option.dest, complexdomain) 13 elif nvalue == 'hfc' : 14 setattr(parser.values, option.dest, hfc) 15 elif nvalue == 'phase' : 16 setattr(parser.values, option.dest, phase) 17 elif nvalue == 'specdiff' : 18 setattr(parser.values, option.dest, specdiff) 19 elif nvalue == 'energy' : 20 setattr(parser.values, option.dest, energy) 21 elif nvalue == 'dual' : 22 setattr(parser.values, option.dest, 'dual') 23 9 24 def parse_args(): 10 25 from optparse import OptionParser 11 26 parser = OptionParser(usage=usage) 27 parser.add_option("-m","--mode", action="callback", 28 callback=check_mode, dest="mode", default='dual', 29 help="onsetdetection mode [default=dual] \ 30 complexdomain|hfc|phase|specdiff|energy|dual") 31 parser.add_option("-o","--outplot", 32 action="store", dest="outplot", default=None, 33 help="be quiet [default=None]") 34 parser.add_option("-t","--threshold", 35 action="store", dest="threshold", default=0.3, 36 help="onset detection threshold [default=0.3]") 37 parser.add_option("-s","--silence", 38 action="store", dest="silence", default=-70, 39 help="silence [default=-70]") 40 parser.add_option("-M","--mintol", 41 action="store", dest="mintol", default=0.048, 42 help="minimum inter onset interval [default=0.048]") 12 43 parser.add_option("-v","--verbose", 13 44 action="store_true", dest="verbose", default=False, … … 16 47 action="store_false", dest="verbose", default=True, 17 48 help="be quiet [default]") 18 parser.add_option("-t","--threshold",19 action="store", dest="threshold", default=0.3,20 help="onset detection threshold [default=0.3]")21 parser.add_option("-s","--silence",22 action="store", dest="silence", default=-70,23 help="silence [default=-70]")24 def check_mode(option, opt, value, parser):25 nvalue = parser.rargs[0]26 if nvalue == 'complexdomain' : setattr(parser.values, option.dest, complexdomain)27 elif nvalue == 'hfc' : setattr(parser.values, option.dest, hfc)28 elif nvalue == 'phase' : setattr(parser.values, option.dest, phase)29 elif nvalue == 'specdiff' : setattr(parser.values, option.dest, specdiff)30 elif nvalue == 'energy' : setattr(parser.values, option.dest, energy)31 elif nvalue == 'dual' : setattr(parser.values, option.dest, 'dual')32 parser.add_option("-m","--mode",33 action="callback", callback=check_mode, dest="mode", default='dual',34 help="onsetdetection mode [default=dual]")35 parser.add_option("-o","--outplot",36 action="store", dest="outplot", default=None,37 help="be quiet [default=None]")38 parser.add_option("-M","--mintol",39 action="store", dest="mintol", default=-70,40 help="mintol [default=0.48]")41 49 (options, args) = parser.parse_args() 42 50 if not len(args):
Note: See TracChangeset
for help on using the changeset viewer.