ref: 0b530cbf3b532383ea84be81b610c7ff41f4d474
dir: /python/aubiopitch/
#!/usr/bin/python def do(filein): from aubio import aubioclass hopsize = 512 bufsize = 4096 frameread = 0 filei = aubioclass.sndfile(filein) srate = filei.samplerate() channels = filei.channels() myvec = aubioclass.fvec(hopsize,channels) readsize = filei.read(hopsize,myvec) ppick = aubioclass.pitchpick(bufsize,hopsize,channels,myvec,srate) while(readsize==hopsize): readsize = filei.read(hopsize,myvec) val = ppick.do(myvec) freq = aubioclass.bintofreq(val,srate,bufsize) now = (frameread)*hopsize/(srate+0.) print "%.3f %.2f" % (now,freq) frameread += 1 if __name__ == "__main__": import sys do(sys.argv[1])