source: python/aubioplot-audio @ 9ea88c6

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

use options structure for plot_audio plot_spec
use options structure for plot_audio plot_spec

  • Property mode set to 100755
File size: 928 bytes
Line 
1#!/usr/bin/python
2
3import sys
4from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_audio
5
6usage = "usage: %s [options] -i soundfile" % sys.argv[0]
7
8def parse_args():
9        from optparse import OptionParser
10        parser = OptionParser(usage=usage)
11        parser.add_option("-i","--input",
12                          action="store", dest="filename", 
13                          help="input sound file")
14        gnuplot_addargs(parser)
15        (options, args) = parser.parse_args()
16        if not options.filename: 
17                 print "no file name given\n", usage
18                 sys.exit(1)
19        return options, args
20
21options, args = parse_args()
22
23if options.outplot: 
24  extension = options.outplot.split('.')[-1] 
25  outplot = '.'.join(options.outplot.split('.')[:-1])
26else: 
27  extension = ''
28  outplot = None
29
30g = gnuplot_create(outplot,extension,options)
31plot_audio(options.filename.split(','), g, options)
Note: See TracBrowser for help on using the repository browser.