ref: b8976d60de7617533762366b5afcc66beef4c36c
parent: 54bf84727272dee8b9618ae9322838a9dd07d909
author: Paul Brossier <piem@altern.org>
date: Mon Aug 8 16:53:36 EDT 2005
added cvec.get(pos,chan), added silence param to getpitch()
--- a/python/aubio/aubioclass.py
+++ b/python/aubio/aubioclass.py
@@ -23,6 +23,8 @@
return self.vec
def __del__(self):
del_cvec(self())
+ def get(self,pos,chan):
+ return fvec_read_sample(self(),chan,pos)
class sndfile:
def __init__(self,filename,model=None):
@@ -203,7 +205,7 @@
return mylist
def getpitch(filein,mode=aubio_mcomb,bufsize=1024,hopsize=512,omode=aubio_freq,
- samplerate=44100.):
+ samplerate=44100.,silence=-70):
frameread = 0
filei = sndfile(filein)
srate = filei.samplerate()
@@ -217,7 +219,10 @@
readsize = filei.read(hopsize,myvec)
freq = pitchdet(myvec)
#print "%.3f %.2f" % (now,freq)
- mylist.append(freq)
+ if (aubio_silence_detection(myvec(),silence)!=1):
+ mylist.append(freq)
+ else:
+ mylist.append(0)
frameread += 1
return mylist