ref: dc27a81952a3cb2abe0efc02005884da470a52c4
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])