From: Paul Brossier Date: Thu, 27 Jul 2006 19:27:20 +0000 (+0000) Subject: add aubioplot-spec X-Git-Tag: bzr2git~582 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=36dfbc6e5a0dae1533f6100358185130fd08758b;p=aubio.git add aubioplot-spec add aubioplot-spec --- diff --git a/python/aubioplot-spec b/python/aubioplot-spec new file mode 100755 index 00000000..fe5ab531 --- /dev/null +++ b/python/aubioplot-spec @@ -0,0 +1,54 @@ +#! /usr/bin/python + +""" this file was written by Paul Brossier + it is released under the GNU/GPL license. +""" + +import sys +from aubio.gnuplot import * + +usage = "usage: %s [options] -i soundfile" % sys.argv[0] + +def parse_args(): + from optparse import OptionParser + parser = OptionParser(usage=usage) + parser.add_option("-i","--input", + action="store", dest="filename", + help="input sound file") + parser.add_option("-M","--maxf", + action="store", dest="maxf", default=0., + type='float',help="higher frequency limit") + parser.add_option("-L","--minf", + action="store", dest="minf", default=0., + type='float',help="lower frequency limit") + parser.add_option("-x","--xsize", + action="store", dest="xsize", default=1., + type='float',help="define xsize for plot") + parser.add_option("-y","--ysize", + action="store", dest="ysize", default=1., + type='float',help="define ysize for plot") + parser.add_option("-l","--log", + action="store_true", dest="log", default=False, + help="plot on a logarithmic scale") + parser.add_option("-O","--outplot", + action="store", dest="outplot", default=None, + help="save plot to output.{ps,png}") + (options, args) = parser.parse_args() + if not options.filename: + print "no file name given\n", usage + sys.exit(1) + return options, args + +options, args = parse_args() +filename = options.filename + +if options.outplot: + extension = options.outplot.split('.')[-1] + outplot = '.'.join(options.outplot.split('.')[:-1]) +else: + extension = '' + outplot = None + +plot_spec(filename, outplot=outplot, extension=extension, log=options.log, + maxf = options.maxf, minf = options.minf, + xsize = options.xsize, ysize = options.ysize)