Changeset 65f1edc


Ignore:
Timestamp:
Nov 30, 2004, 11:17:19 PM (19 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:
09b082d
Parents:
00e4659
Message:

updated aubiocut
aubiocut now seeks local minima before the peak, to cut at the beginning of the
attack rather than at an arbitrary three frames ahead of the peak.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/aubiocut

    r00e4659 r65f1edc  
    88import sys
    99
     10bufsize   = 1024
     11hopsize   = bufsize/2
     12
    1013def getonsets(filein,threshold):
    11         bufsize   = 1024
    12         hopsize   = bufsize/2
    1314        frameread = 0
    1415        filei     = sndfile(filein)
     
    2122        #fileo     = sndfile(newname,model=filei)
    2223        mylist    = list()
     24        ovalist   = [0., 0., 0., 0., 0., 0.]
    2325        while(readsize==hopsize):
    2426                readsize = filei.read(hopsize,myvec)
    2527                isonset,val = opick.do(myvec)
     28                ovalist.append(val)
     29                ovalist.pop(0)
    2630                if (isonset == 1):
    27                     now = (frameread-4)*hopsize/(srate+0.)
    28                     #del fileo
    29                     #fileo = sndfile("%s%f%s" % ("/tmp/",now,filein[-4:]),model=filei)
    30                     mylist.append(now)
     31                        print frameread
     32                        i=len(ovalist)-1
     33                        # find local minima
     34                        while ovalist[i-1] < ovalist[i] and i > 0:
     35                                i -= 1
     36                        now = (frameread-i+1)*hopsize/(srate+0.)
     37                        #del fileo
     38                        #fileo = sndfile("%s%f%s" % ("/tmp/",now,filein[-4:]),model=filei)
     39                        mylist.append(now)
    3140                #writesize = fileo.write(readsize,myoldvec)
    3241                frameread += 1
     
    3443
    3544def cutfile(filein,onsets):
    36         hopsize   = 512
    3745        frameread = 0
    3846        readsize  = hopsize
Note: See TracChangeset for help on using the changeset viewer.