History

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.

Paul Brossier committed 21 years ago

Commit 65f1edc1 parent 00e46591 file · +15 −7Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/aubiocut+15−7
@@ -7,9 +7,10 @@ · 6 unmodified lines
7from aubio.aubioclass import *7from aubio.aubioclass import *
8import sys8import sys
9 9
10bufsize = 1024
11hopsize = bufsize/2
12
10def getonsets(filein,threshold):13def getonsets(filein,threshold):
11 bufsize = 1024
12 hopsize = bufsize/2
13 frameread = 014 frameread = 0
14 filei = sndfile(filein)15 filei = sndfile(filein)
15 srate = filei.samplerate()16 srate = filei.samplerate()
@@ -20,20 +21,27 @@ def getonsets(filein,threshold): · 4 unmodified lines
20 #newname = "%s%.8f%s" % ("/tmp/",0.0000000,filein[-4:])21 #newname = "%s%.8f%s" % ("/tmp/",0.0000000,filein[-4:])
21 #fileo = sndfile(newname,model=filei)22 #fileo = sndfile(newname,model=filei)
22 mylist = list()23 mylist = list()
24 ovalist = [0., 0., 0., 0., 0., 0.]
23 while(readsize==hopsize):25 while(readsize==hopsize):
24 readsize = filei.read(hopsize,myvec)26 readsize = filei.read(hopsize,myvec)
25 isonset,val = opick.do(myvec)27 isonset,val = opick.do(myvec)
28 ovalist.append(val)
29 ovalist.pop(0)
26 if (isonset == 1):30 if (isonset == 1):
27 now = (frameread-4)*hopsize/(srate+0.)31 print frameread
28 #del fileo32 i=len(ovalist)-1
29 #fileo = sndfile("%s%f%s" % ("/tmp/",now,filein[-4:]),model=filei)33 # find local minima
30 mylist.append(now)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)
31 #writesize = fileo.write(readsize,myoldvec)40 #writesize = fileo.write(readsize,myoldvec)
32 frameread += 141 frameread += 1
33 return mylist42 return mylist
34 43
35def cutfile(filein,onsets):44def cutfile(filein,onsets):
36 hopsize = 512
37 frameread = 045 frameread = 0
38 readsize = hopsize 46 readsize = hopsize
39 filei = sndfile(filein)47 filei = sndfile(filein)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t