- Timestamp:
- Nov 5, 2018, 2:02:20 PM (6 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
- Children:
- bc1ed63
- Parents:
- f8c75aa
- Location:
- python/lib/aubio
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/cmd.py
rf8c75aa rdc74f69 12 12 import sys 13 13 import argparse 14 import warnings 14 15 import aubio 15 16 … … 508 509 509 510 def flush(self, frames_read, samplerate): 510 from aubio.cut import _cut_slice511 511 _cut_slice(self.options, self.slices) 512 512 duration = float(frames_read) / float(samplerate) … … 518 518 info += base_info 519 519 sys.stderr.write(info) 520 521 def _cut_slice(options, timestamps): 522 # cutting pass 523 nstamps = len(timestamps) 524 if nstamps > 0: 525 # generate output files 526 timestamps_end = None 527 if options.cut_every_nslices: 528 timestamps = timestamps[::options.cut_every_nslices] 529 nstamps = len(timestamps) 530 if options.cut_until_nslices and options.cut_until_nsamples: 531 msg = "using cut_until_nslices, but cut_until_nsamples is set" 532 warnings.warn(msg) 533 if options.cut_until_nsamples: 534 lag = options.cut_until_nsamples 535 timestamps_end = [t + lag for t in timestamps[1:]] 536 timestamps_end += [1e120] 537 if options.cut_until_nslices: 538 slice_lag = options.cut_until_nslices 539 timestamps_end = [t for t in timestamps[1 + slice_lag:]] 540 timestamps_end += [1e120] * (options.cut_until_nslices + 1) 541 aubio.slice_source_at_stamps(options.source_uri, 542 timestamps, timestamps_end = timestamps_end, 543 output_dir = options.output_directory, 544 samplerate = options.samplerate, 545 create_first = options.create_first) 520 546 521 547 def main(): -
python/lib/aubio/cut.py
rf8c75aa rdc74f69 6 6 7 7 import sys 8 import warnings 9 from aubio.cmd import AubioArgumentParser 10 from aubio.slicing import slice_source_at_stamps 11 8 from aubio.cmd import AubioArgumentParser, _cut_slice 12 9 13 10 def aubio_cut_parser(): … … 137 134 return timestamps, total_frames 138 135 139 140 def _cut_slice(options, timestamps):141 # cutting pass142 nstamps = len(timestamps)143 if nstamps > 0:144 # generate output files145 timestamps_end = None146 if options.cut_every_nslices:147 timestamps = timestamps[::options.cut_every_nslices]148 nstamps = len(timestamps)149 if options.cut_until_nslices and options.cut_until_nsamples:150 msg = "using cut_until_nslices, but cut_until_nsamples is set"151 warnings.warn(msg)152 if options.cut_until_nsamples:153 lag = options.cut_until_nsamples154 timestamps_end = [t + lag for t in timestamps[1:]]155 timestamps_end += [1e120]156 if options.cut_until_nslices:157 slice_lag = options.cut_until_nslices158 timestamps_end = [t for t in timestamps[1 + slice_lag:]]159 timestamps_end += [1e120] * (options.cut_until_nslices + 1)160 slice_source_at_stamps(options.source_uri,161 timestamps, timestamps_end = timestamps_end,162 output_dir = options.output_directory,163 samplerate = options.samplerate,164 create_first = options.create_first)165 166 136 def main(): 167 137 parser = aubio_cut_parser()
Note: See TracChangeset
for help on using the changeset viewer.