Changeset c0ec39c


Ignore:
Timestamp:
Dec 1, 2004, 8:05:19 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:
e997b1a
Parents:
36bc60c
Message:
 
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    r36bc60c rc0ec39c  
    22        * configure.ac: added -lmx on macosx
    33        * python/aubiocut: seeks for local minima before peak
     4                           added zero crossing search
    45        * src/pitchyinc.c: adds draft for all-in-one faster function
    56        * examples/*.c: added ladcca client (needs work)
  • python/aubiocut

    r36bc60c rc0ec39c  
    88import sys
    99
    10 bufsize   = 1024
     10bufsize   = 512
    1111hopsize   = bufsize/2
    1212
     
    2929                ovalist.pop(0)
    3030                if (isonset == 1):
    31                         print frameread
    3231                        i=len(ovalist)-1
    3332                        # find local minima
    3433                        while ovalist[i-1] < ovalist[i] and i > 0:
    3534                                i -= 1
    36                         now = (frameread-i+1)*hopsize/(srate+0.)
     35                        now = (frameread+1-i)*hopsize/(srate+0.)
    3736                        #del fileo
    3837                        #fileo = sndfile("%s%f%s" % ("/tmp/",now,filein[-4:]),model=filei)
     
    5150        fileo     = sndfile(newname,model=filei)
    5251        myvec     = fvec(hopsize,channels)
     52        mycopy    = fvec(hopsize,channels)
    5353        while(readsize==hopsize):
    5454                readsize = filei.read(hopsize,myvec)
    5555                now = (frameread)*hopsize/(srate+0.)
    56                 writesize = fileo.write(readsize,myvec)
    57                 if len(onsets) and now == onsets[0]:
     56                # write to current file
     57                if len(onsets) and now >= onsets[0]:
    5858                    onsets.pop(0)
     59                    # write up to 1st zero crossing
     60                    zerocross = 0
     61                    while ( abs( myvec.get(zerocross,0) ) > 0.002 ):
     62                        zerocross += 1
     63                    writesize = fileo.write(zerocross,myvec)
     64                    fromcross = 0
     65                    while (zerocross < readsize):
     66                        mycopy.set(myvec.get(zerocross,0),fromcross,0)
     67                        fromcross += 1
     68                        zerocross += 1
    5969                    del fileo
    60                     fileo = sndfile("%s%f%s%s" % ("/tmp/",now,".",filein.split(".")[-1]),model=filei)
     70                    fileo = sndfile("%s%s%f%s%s" %
     71                        (filein.split(".")[0].split("/")[-1],".",now,".",filein.split(".")[-1]),model=filei)
     72                    # write after 1st zero crossing to new file
     73                    writesize = fileo.write(fromcross,mycopy)
     74                else:
     75                    writesize = fileo.write(readsize,myvec)
    6176                frameread += 1
    6277        del fileo
Note: See TracChangeset for help on using the changeset viewer.