Changeset c0ec39c
- Timestamp:
- Dec 1, 2004, 8:05:19 PM (20 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:
- e997b1a
- Parents:
- 36bc60c
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r36bc60c rc0ec39c 2 2 * configure.ac: added -lmx on macosx 3 3 * python/aubiocut: seeks for local minima before peak 4 added zero crossing search 4 5 * src/pitchyinc.c: adds draft for all-in-one faster function 5 6 * examples/*.c: added ladcca client (needs work) -
python/aubiocut
r36bc60c rc0ec39c 8 8 import sys 9 9 10 bufsize = 102410 bufsize = 512 11 11 hopsize = bufsize/2 12 12 … … 29 29 ovalist.pop(0) 30 30 if (isonset == 1): 31 print frameread32 31 i=len(ovalist)-1 33 32 # find local minima 34 33 while ovalist[i-1] < ovalist[i] and i > 0: 35 34 i -= 1 36 now = (frameread -i+1)*hopsize/(srate+0.)35 now = (frameread+1-i)*hopsize/(srate+0.) 37 36 #del fileo 38 37 #fileo = sndfile("%s%f%s" % ("/tmp/",now,filein[-4:]),model=filei) … … 51 50 fileo = sndfile(newname,model=filei) 52 51 myvec = fvec(hopsize,channels) 52 mycopy = fvec(hopsize,channels) 53 53 while(readsize==hopsize): 54 54 readsize = filei.read(hopsize,myvec) 55 55 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]: 58 58 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 59 69 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) 61 76 frameread += 1 62 77 del fileo
Note: See TracChangeset
for help on using the changeset viewer.