Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -0,0 +1,33 @@ | ||
| 1 | +#!/usr/bin/python | |
| 2 | + | |
| 3 | +import aubio.gnuplot, sys | |
| 4 | + | |
| 5 | +usage = "usage: %s [options] -i soundfile" % sys.argv[0] | |
| 6 | + | |
| 7 | +def parse_args(): | |
| 8 | + from optparse import OptionParser | |
| 9 | + parser = OptionParser(usage=usage) | |
| 10 | + parser.add_option("-i","--input", | |
| 11 | + action="store", dest="filename", | |
| 12 | + help="input sound file") | |
| 13 | + parser.add_option("-x","--xsize", | |
| 14 | + action="store", dest="xsize", default=1., | |
| 15 | + help="define xsize for plot") | |
| 16 | + parser.add_option("-y","--ysize", | |
| 17 | + action="store", dest="ysize", default=1., | |
| 18 | + help="define ysize for plot") | |
| 19 | + parser.add_option("-O","--outplot", | |
| 20 | + action="store", dest="outplot", default=None, | |
| 21 | + help="save plot to output.{ps,png}") | |
| 22 | + (options, args) = parser.parse_args() | |
| 23 | + if not options.filename: | |
| 24 | + print "no file name given\n", usage | |
| 25 | + sys.exit(1) | |
| 26 | + return options, args | |
| 27 | + | |
| 28 | +options, args = parse_args() | |
| 29 | + | |
| 30 | +aubio.gnuplot.plot_audio(options.filename.split(','), | |
| 31 | + fileout=options.outplot, | |
| 32 | + xsize=float(options.xsize), | |
| 33 | + ysize=float(options.ysize)) | |