ref: 32fa8e816aaf24cce0c79dd1cab463fbbf0b9e26
parent: 5ed91337e8f09722099cefcc84e8a4e2679ac83e
author: Paul Brossier <piem@altern.org>
date: Wed Aug 2 10:55:29 EDT 2006
reuse downsample_audio in make_audio_plot reuse downsample_audio in make_audio_plot
--- a/python/aubio/gnuplot.py
+++ b/python/aubio/gnuplot.py
@@ -147,25 +147,20 @@
#xorig += 1./todraw
def downsample_audio(time,data,maxpoints=10000):
- """ resample audio data to last only maxpoints """
- import numarray
- length = len(time)
- downsample = length/maxpoints
- if downsample == 0: downsample = 1
- x = numarray.array(time).resize(length)[0:-1:downsample]
- y = numarray.array(data).resize(length)[0:-1:downsample]
- return x,y
+ """ resample audio data to last only maxpoints """
+ import numarray
+ length = len(time)
+ downsample = length/maxpoints
+ if downsample == 0: downsample = 1
+ x = numarray.array(time).resize(length)[0:-1:downsample]
+ y = numarray.array(data).resize(length)[0:-1:downsample]
+ return x,y
def make_audio_plot(time,data,maxpoints=10000):
- """ create gnuplot plot from an audio file """
- import numarray
- import Gnuplot, Gnuplot.funcutils
- length = len(time)
- downsample = length/maxpoints
- if downsample == 0: downsample = 1
- x = numarray.array(time).resize(length)[0:-1:downsample]
- y = numarray.array(data).resize(length)[0:-1:downsample]
- return Gnuplot.Data(x,y,with='lines')
+ """ create gnuplot plot from an audio file """
+ import Gnuplot, Gnuplot.funcutils
+ x,y = downsample_audio(time,data,maxpoints=maxpoints)
+ return Gnuplot.Data(x,y,with='lines')
def gnuplot_create(outplot='',extension='',debug=0,persist=1, xsize=1., ysize=1.):
import Gnuplot