#!/usr/bin/python def do(filein,threshold): import aubio.aubioclass as aubio hopsize = 512 bufsize = 1024 frameread = 0 filei = aubio.sndfile(filein) srate = filei.samplerate() channels = filei.channels() myvec = aubio.fvec(hopsize,channels) readsize = filei.read(hopsize,myvec) opick = aubio.onsetpick(bufsize,hopsize,channels,myvec,threshold) mylist = list() while(readsize==hopsize): readsize = filei.read(hopsize,myvec) isonset,val = opick.do(myvec) if (isonset == 1): now = (frameread-3)*hopsize/(srate+0.) print "%.8f\t%.2f"% (now,val) frameread += 1 if __name__ == "__main__": import sys do(sys.argv[1],sys.argv[2])