Showing the changes to python (2 of 2 files). Show all
Unified · Split
| @@ -45,8 +45,8 @@ def audio_to_array(filename): · 44 unmodified lines | ||
| 45 | 45 | time = numarray.arange(len(data))*framestep |
| 46 | 46 | return time,data |
| 47 | 47 | |
| 48 | −def plot_audio(filenames, fileout=None, start=0, end=None, noaxis=None,xsize=1.,ysize=1.): | |
| 49 | − g = gnuplot_init(fileout) | |
| 48 | +def plot_audio(filenames, outplot='', extension='', start=0, end=None, noaxis=None,xsize=1.,ysize=1.): | |
| 49 | + g = gnuplot_create(outplot, extension) | |
| 50 | 50 | d = [] |
| 51 | 51 | todraw = len(filenames) |
| 52 | 52 | xorig = 0. |
| @@ -27,7 +27,15 @@ def parse_args(): · 26 unmodified lines | ||
| 27 | 27 | |
| 28 | 28 | options, args = parse_args() |
| 29 | 29 | |
| 30 | +if options.outplot: | |
| 31 | + extension = options.outplot.split('.')[-1] | |
| 32 | + outplot = '.'.join(options.outplot.split('.')[:-1]) | |
| 33 | +else: | |
| 34 | + extension = '' | |
| 35 | + outplot = None | |
| 36 | + | |
| 30 | 37 | aubio.gnuplot.plot_audio(options.filename.split(','), |
| 31 | − fileout=options.outplot, | |
| 38 | + extension = extension, | |
| 39 | + outplot = outplot, | |
| 32 | 40 | xsize=float(options.xsize), |
| 33 | 41 | ysize=float(options.ysize)) |