source: python/aubioplot-audio @ 5ed9133

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 5ed9133 was e5cc1ea, checked in by Paul Brossier <piem@altern.org>, 18 years ago

pass created plot to plot_audio/spec instead of outplot/extension, minor fixes
pass created plot to plot_audio/spec instead of outplot/extension, minor fixes

  • Property mode set to 100755
File size: 1.4 KB
Line 
1#!/usr/bin/python
2
3import aubio.gnuplot, sys
4
5usage = "usage: %s [options] -i soundfile" % sys.argv[0]
6
7def 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                          type='float',help="define xsize for plot")
16        parser.add_option("-y","--ysize",
17                          action="store", dest="ysize", default=1., 
18                          type='float',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
28options, args = parse_args()
29
30if options.outplot: 
31  extension = options.outplot.split('.')[-1] 
32  outplot = '.'.join(options.outplot.split('.')[:-1])
33else: 
34  extension = ''
35  outplot = None
36
37g = aubio.gnuplot.gnuplot_create(outplot,extension,xsize=options.xsize, ysize=options.xsize)
38aubio.gnuplot.plot_audio(options.filename.split(','), g,
39  xsize=options.xsize,
40  ysize=options.ysize)
Note: See TracBrowser for help on using the repository browser.