source: python/aubioplot-audio @ 49407f3

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since 49407f3 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
RevLine 
[da5edf3]1#!/usr/bin/python
2
[0ab19df]3import sys
4from aubio.gnuplot import gnuplot_create,gnuplot_addargs,plot_audio
[da5edf3]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")
[0ab19df]14        gnuplot_addargs(parser)
[da5edf3]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
[9bb8151]23if options.outplot: 
24  extension = options.outplot.split('.')[-1] 
25  outplot = '.'.join(options.outplot.split('.')[:-1])
26else: 
27  extension = ''
28  outplot = None
29
[0ab19df]30g = gnuplot_create(outplot,extension,options)
[33cf541]31plot_audio(options.filename.split(','), g, options)
Note: See TracBrowser for help on using the repository browser.