History

added cvec.get(pos,chan), added silence param to getpitch()

Paul Brossier committed 21 years ago

Commit b8976d61 parent 54bf8471 file · +7 −2Browse files

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

Unified · Split

python/aubio/aubioclass.py+7−2
@@ -23,6 +23,8 @@ class cvec: · 22 unmodified lines
23 return self.vec23 return self.vec
24 def __del__(self):24 def __del__(self):
25 del_cvec(self())25 del_cvec(self())
26 def get(self,pos,chan):
27 return fvec_read_sample(self(),chan,pos)
26 28
27class sndfile:29class sndfile:
28 def __init__(self,filename,model=None):30 def __init__(self,filename,model=None):
@@ -203,7 +205,7 @@ def getsilences(filein,hopsize=512,silence=-70): · 174 unmodified lines
203 return mylist205 return mylist
204 206
205def getpitch(filein,mode=aubio_mcomb,bufsize=1024,hopsize=512,omode=aubio_freq,207def getpitch(filein,mode=aubio_mcomb,bufsize=1024,hopsize=512,omode=aubio_freq,
206 samplerate=44100.):208 samplerate=44100.,silence=-70):
207 frameread = 0209 frameread = 0
208 filei = sndfile(filein)210 filei = sndfile(filein)
209 srate = filei.samplerate()211 srate = filei.samplerate()
@@ -217,7 +219,10 @@ def getpitch(filein,mode=aubio_mcomb,bufsize=1024,hopsize=512,omode=aubio_freq, · 7 unmodified lines
217 readsize = filei.read(hopsize,myvec)219 readsize = filei.read(hopsize,myvec)
218 freq = pitchdet(myvec)220 freq = pitchdet(myvec)
219 #print "%.3f %.2f" % (now,freq)221 #print "%.3f %.2f" % (now,freq)
220 mylist.append(freq)222 if (aubio_silence_detection(myvec(),silence)!=1):
223 mylist.append(freq)
224 else:
225 mylist.append(0)
221 frameread += 1226 frameread += 1
222 return mylist227 return mylist
223 228

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