Changeset a0fd4e4 for python


Ignore:
Timestamp:
Apr 2, 2005, 3:29:23 PM (20 years ago)
Author:
Paul Brossier <piem@altern.org>
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:
cf7c76a
Parents:
e50b695
Message:

merge aubionotes and aubionotesmedian

add make_audio_plot to gnuplot.py
adds autocorrelation to mathutils
adds Makefile.in to junk files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubio/gnuplot.py

    re50b695 ra0fd4e4  
    109109                        data.append(myvec.get(curpos,i))
    110110                        curpos+=1
    111         # FIXME again for the last frame
    112         curpos = 0
    113         while (curpos < readsize):
    114                 data.append(myvec.get(curpos,i))
    115                 curpos+=1
    116111        time = arange(len(data))*framestep
    117112        return time,data
    118113
    119 def plot_audio(filenames, fileout=None, start=0, end=None, noaxis=None, task=audio_to_array):
     114def plot_audio(filenames, fileout=None, start=0, end=None, noaxis=None):
    120115        g = Gnuplot.Gnuplot(debug=1, persist=1)
    121116        d = []
     
    125120        g.gnuplot('set multiplot;')
    126121        while (len(filenames)):
    127                 b,a = task(filenames.pop(0))
    128                 d.append(Gnuplot.Data(b,a))
     122                d.append(plot_audio_make(filenames.pop(0)))
    129123                if not noaxis and todraw==1:
    130124                        g.xlabel('Time (s)')
     
    141135                g.hardcopy(fileout, enhanced=1, color=0)
    142136
     137def make_audio_plot(time,data,maxpoints=10000):
     138        """ create gnuplot plot from an audio file """
     139        import numarray
     140        length = len(time)
     141        downsample = length/maxpoints
     142        if downsample == 0: downsample = 1
     143        x = numarray.array(time).resize(length)[0:-1:downsample]
     144        y = numarray.array(data).resize(length)[0:-1:downsample]
     145        return Gnuplot.Data(x,y,with='lines')
Note: See TracChangeset for help on using the changeset viewer.