source: python/aubioonset @ e6d4ccb

feature/autosinkfeature/cnnfeature/cnn_orgfeature/constantqfeature/crepefeature/crepe_orgfeature/pitchshiftfeature/pydocstringsfeature/timestretchfix/ffmpeg5pitchshiftsamplertimestretchyinfft+
Last change on this file since e6d4ccb was 96fb8ad, checked in by Paul Brossier <piem@altern.org>, 20 years ago

import 0.1.7.1

  • Property mode set to 100755
File size: 868 bytes
RevLine 
[96fb8ad]1#!/usr/bin/python
2
3def do(filein,threshold):
4        import aubio.aubioclass as aubio
5        hopsize   = 512
6        bufsize   = 1024
7        frameread = 0
8        filei     = aubio.sndfile(filein)
9        srate     = filei.samplerate()
10        channels  = filei.channels() 
11        myvec     = aubio.fvec(hopsize,channels)
12        readsize  = filei.read(hopsize,myvec)
13        opick     = aubio.onsetpick(bufsize,hopsize,channels,myvec,threshold)
14        mylist    = list()
15        while(readsize==hopsize):
16                readsize = filei.read(hopsize,myvec)
17                isonset,val = opick.do(myvec) 
18                if (isonset == 1):
19                    now = (frameread-3)*hopsize/(srate+0.)
20                    print "%.8f\t%.2f"% (now,val)
21                frameread += 1
22
23if __name__ == "__main__":
24        import sys
25        do(sys.argv[1],sys.argv[2])
Note: See TracBrowser for help on using the repository browser.