From: Paul Brossier Date: Sat, 28 May 2005 03:21:55 +0000 (+0000) Subject: fixed default mintol, arrange tabulations X-Git-Tag: bzr2git~904 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=946cad34846fd7d3cb186ddbddfee6b69a9dcf5f;p=aubio.git fixed default mintol, arrange tabulations --- diff --git a/python/aubioonset b/python/aubioonset index dd274825..a66df402 100755 --- a/python/aubioonset +++ b/python/aubioonset @@ -6,38 +6,46 @@ from aubio.aubioclass import * usage = "usage: %s [options] soundfile" % sys.argv[0] +def check_mode(option, opt, value, parser): + nvalue = parser.rargs[0] + if nvalue == 'complexdomain' : + setattr(parser.values, option.dest, complexdomain) + elif nvalue == 'hfc' : + setattr(parser.values, option.dest, hfc) + elif nvalue == 'phase' : + setattr(parser.values, option.dest, phase) + elif nvalue == 'specdiff' : + setattr(parser.values, option.dest, specdiff) + elif nvalue == 'energy' : + setattr(parser.values, option.dest, energy) + elif nvalue == 'dual' : + setattr(parser.values, option.dest, 'dual') + def parse_args(): from optparse import OptionParser parser = OptionParser(usage=usage) - parser.add_option("-v","--verbose", - action="store_true", dest="verbose", default=False, - help="make lots of noise") - parser.add_option("-q","--quiet", - action="store_false", dest="verbose", default=True, - help="be quiet [default]") + parser.add_option("-m","--mode", action="callback", + callback=check_mode, dest="mode", default='dual', + help="onsetdetection mode [default=dual] \ + complexdomain|hfc|phase|specdiff|energy|dual") + parser.add_option("-o","--outplot", + action="store", dest="outplot", default=None, + help="be quiet [default=None]") parser.add_option("-t","--threshold", action="store", dest="threshold", default=0.3, help="onset detection threshold [default=0.3]") parser.add_option("-s","--silence", action="store", dest="silence", default=-70, help="silence [default=-70]") - def check_mode(option, opt, value, parser): - nvalue = parser.rargs[0] - if nvalue == 'complexdomain' : setattr(parser.values, option.dest, complexdomain) - elif nvalue == 'hfc' : setattr(parser.values, option.dest, hfc) - elif nvalue == 'phase' : setattr(parser.values, option.dest, phase) - elif nvalue == 'specdiff' : setattr(parser.values, option.dest, specdiff) - elif nvalue == 'energy' : setattr(parser.values, option.dest, energy) - elif nvalue == 'dual' : setattr(parser.values, option.dest, 'dual') - parser.add_option("-m","--mode", - action="callback", callback=check_mode, dest="mode", default='dual', - help="onsetdetection mode [default=dual]") - parser.add_option("-o","--outplot", - action="store", dest="outplot", default=None, - help="be quiet [default=None]") parser.add_option("-M","--mintol", - action="store", dest="mintol", default=-70, - help="mintol [default=0.48]") + action="store", dest="mintol", default=0.048, + help="minimum inter onset interval [default=0.048]") + parser.add_option("-v","--verbose", + action="store_true", dest="verbose", default=False, + help="make lots of noise") + parser.add_option("-q","--quiet", + action="store_false", dest="verbose", default=True, + help="be quiet [default]") (options, args) = parser.parse_args() if not len(args): print "no file name given\n", usage