source: python/aubioplot-audio @ 9bb8151

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

use gnuplot_create in plot_audio
use gnuplot_create in plot_audio

  • 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                          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
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
37aubio.gnuplot.plot_audio(options.filename.split(','),
38  extension = extension,
39  outplot = outplot,
40  xsize=float(options.xsize),
41  ysize=float(options.ysize))
Note: See TracBrowser for help on using the repository browser.