Changeset 94b16e89 for python


Ignore:
Timestamp:
Jan 12, 2014, 8:40:22 AM (11 years ago)
Author:
Paul Brossier <piem@piem.org>
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:
9e58e78
Parents:
35a44e9
Message:

python/scripts/aubiocut: add --cut-until-nsamples and --cut-until-nslices options

File:
1 edited

Legend:

Unmodified
Added
Removed
  • python/scripts/aubiocut

    r35a44e9 r94b16e89  
    111111            action="store", dest="output_directory", default=None,
    112112            help="specify path where slices of the original file should be created")
     113    parser.add_option("--cut-until-nsamples", type = int,
     114            metavar = "<samples>",
     115            action = "store", dest = "cut_until_nsamples", default = None,
     116            help="how many extra samples should be added at the end of each slice")
     117    parser.add_option("--cut-until-nslices", type = int,
     118            metavar = "<slices>",
     119            action = "store", dest = "cut_until_nslices", default = None,
     120            help="how many extra slices should be added at the end of each slice")
     121
    113122    parser.add_option("-v","--verbose",
    114123            action="store_true", dest="verbose", default=True,
     
    166175    # cutting pass
    167176    if options.cut and nstamps > 0:
    168         # generate output filenames
     177        # generate output files
    169178        from aubio.slicing import slice_source_at_stamps
    170         slice_source_at_stamps(source_file, timestamps,
     179        timestamps_end = None
     180        if options.cut_until_nslices and options.cut_until_nsamples:
     181            print "warning: using cut_until_nslices, but cut_until_nsamples is set"
     182        if options.cut_until_nsamples:
     183            timestamps_end = [t + options.cut_until_nsamples for t in timestamps[1:]]
     184            timestamps_end += [ 1e120 ]
     185        if options.cut_until_nslices:
     186            timestamps_end = [t for t in timestamps[1 + options.cut_until_nslices:]]
     187            timestamps_end += [ 1e120 ] * (options.cut_until_nslices + 1)
     188        slice_source_at_stamps(source_file, timestamps, timestamps_end = timestamps_end,
    171189                output_dir = options.output_directory)
    172190
Note: See TracChangeset for help on using the changeset viewer.