Changeset 5e491b3b for python/aubiocut
- Timestamp:
- Aug 28, 2005, 7:58:31 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 3c86eb1
- Parents:
- 4cc9fe5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/aubiocut
r4cc9fe5 r5e491b3b 6 6 7 7 import sys 8 from aubio. aubioclass import *8 from aubio.tasks import * 9 9 10 10 usage = "usage: %s [options] -i soundfile" % sys.argv[0] … … 89 89 silence = float(options.silence) 90 90 mintol = float(options.mintol)*step 91 mode = options.mode 91 92 # default take back system delay 92 93 if options.delay: delay = float(options.delay) … … 98 99 elif options.silencecut: 99 100 onsets = getsilences(filename,hopsize=hopsize,silence=silence) 100 elif options.plot: 101 elif options.plot: storefunc=True 102 else: storefunc=False 103 104 lonsets, lofunc = [], [] 105 for i in range(len(mode)): 101 106 onsets, ofunc = getonsets(filename,threshold,silence, 102 mode= options.mode,localmin=options.localmin,107 mode=mode[i],localmin=options.localmin, 103 108 derivate=options.derivate, 104 109 bufsize=bufsize,hopsize=hopsize,storefunc=True) 105 else:106 onsets = getonsets(filename,threshold,silence,107 mode=options.mode,localmin=options.localmin,108 derivate=options.derivate,109 bufsize=bufsize,hopsize=hopsize)110 110 111 # take back system delay112 if delay != 0:113 for i in range(len(onsets)):114 onsets[i] -= delay*step111 # take back system delay 112 if delay != 0: 113 for i in range(len(onsets)): 114 onsets[i] -= delay*step 115 115 116 # prune doubled 117 if mintol > 0: 118 last = -2*mintol 119 newonsets = [] 120 for new in onsets: 121 if (new - last > mintol): 122 newonsets.append(new) 123 last = new 124 onsets = newonsets 116 # prune doubled 117 if mintol > 0: 118 last = -2*mintol 119 newonsets = [] 120 for new in onsets: 121 if (new - last > mintol): 122 newonsets.append(new) 123 last = new 124 onsets = newonsets 125 126 lonsets.append(onsets) 127 lofunc.append(ofunc) 125 128 126 129 # print times in second 127 130 if options.verbose: 128 for i in onsets: print "%f" % (i/step) 131 maxonset = 0 132 for j in range(len(mode)): 133 for i in range(len(lonsets[j])): 134 print lonsets[j][i]/step 129 135 130 136 if options.plot: 131 137 from aubio.gnuplot import plot_onsets 132 plot_onsets(filename, onsets,ofunc,138 plot_onsets(filename, lonsets, lofunc, 133 139 samplerate=samplerate, hopsize=hopsize, outplot=options.outplot) 134 140
Note: See TracChangeset
for help on using the changeset viewer.