Changeset 32fa8e8 for python/aubio/gnuplot.py
- Timestamp:
- Aug 2, 2006, 4:55:29 PM (18 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 0ab19df
- Parents:
- 5ed9133
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubio/gnuplot.py
r5ed9133 r32fa8e8 148 148 149 149 def downsample_audio(time,data,maxpoints=10000): 150 151 152 153 154 155 156 157 150 """ resample audio data to last only maxpoints """ 151 import numarray 152 length = len(time) 153 downsample = length/maxpoints 154 if downsample == 0: downsample = 1 155 x = numarray.array(time).resize(length)[0:-1:downsample] 156 y = numarray.array(data).resize(length)[0:-1:downsample] 157 return x,y 158 158 159 159 def make_audio_plot(time,data,maxpoints=10000): 160 """ create gnuplot plot from an audio file """ 161 import numarray 162 import Gnuplot, Gnuplot.funcutils 163 length = len(time) 164 downsample = length/maxpoints 165 if downsample == 0: downsample = 1 166 x = numarray.array(time).resize(length)[0:-1:downsample] 167 y = numarray.array(data).resize(length)[0:-1:downsample] 168 return Gnuplot.Data(x,y,with='lines') 160 """ create gnuplot plot from an audio file """ 161 import Gnuplot, Gnuplot.funcutils 162 x,y = downsample_audio(time,data,maxpoints=maxpoints) 163 return Gnuplot.Data(x,y,with='lines') 169 164 170 165 def gnuplot_create(outplot='',extension='',debug=0,persist=1, xsize=1., ysize=1.):
Note: See TracChangeset
for help on using the changeset viewer.