Changeset 7fc5ba2
- Timestamp:
- Oct 17, 2013, 2:54:51 PM (11 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:
- dc467b5d
- Parents:
- 7079887
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/scripts/aubiocut
r7079887 r7fc5ba2 9 9 10 10 usage = "usage: %s [options] -i soundfile" % sys.argv[0] 11 usage += "\n help: %s -h" % sys.argv[0]11 usage += "\n help: %s -h" % sys.argv[0] 12 12 13 13 def parse_args(): … … 22 22 complexdomain|hfc|phase|specdiff|energy|kl|mkl") 23 23 # cutting methods 24 """25 24 parser.add_option("-b","--beat", 26 25 action="store_true", dest="beat", default=False, 27 26 help="use beat locations") 27 """ 28 28 parser.add_option("-S","--silencecut", 29 29 action="store_true", dest="silencecut", default=False, … … 41 41 parser.add_option("-B","--bufsize", 42 42 action="store", dest="bufsize", default=512, 43 metavar = "<size>", 43 metavar = "<size>", type='int', 44 44 help="buffer size [default=512]") 45 45 parser.add_option("-H","--hopsize", 46 metavar = "<size>", 46 metavar = "<size>", type='int', 47 47 action="store", dest="hopsize", default=256, 48 48 help="overlap size [default=256]") … … 127 127 source_file = options.source_file 128 128 129 from aubio import onset, source, sink129 from aubio import onset, tempo, source, sink 130 130 131 131 s = source(source_file, samplerate, hopsize) 132 132 if samplerate == 0: samplerate = s.get_samplerate() 133 133 134 o = onset(options.onset_method, bufsize, hopsize) 134 if options.beat: 135 o = tempo(options.onset_method, bufsize, hopsize) 136 else: 137 o = onset(options.onset_method, bufsize, hopsize) 135 138 o.set_threshold(options.threshold) 136 139 … … 141 144 samples, read = s() 142 145 if o(samples): 143 this_onset = o.get_last_onset() 144 if options.verbose: print "%.4f" % o.get_last_onset_s() 145 timestamps.append (this_onset) 146 timestamps.append (o.get_last()) 147 if options.verbose: print "%.4f" % o.get_last_s() 146 148 total_frames += read 147 149 if read < hopsize: break 148 150 del s 149 151 # print some info 150 152 nstamps = len(timestamps) … … 162 164 return source_base_name + '_%02.3f' % (timestamp) + '.wav' 163 165 # reopen source file 164 del s165 166 s = source(source_file, samplerate, hopsize) 167 if samplerate == 0: samplerate = s.get_samplerate() 166 168 # create first sink at 0 167 169 g = sink(new_sink_name(source_base_name, 0.), samplerate)
Note: See TracChangeset
for help on using the changeset viewer.