Showing the changes to python/scripts (1 of 1 file). Show all
Unified · Split
| @@ -110,6 +110,15 @@ def parse_args(): · 109 unmodified lines | ||
| 110 | 110 | metavar = "<outputdir>", |
| 111 | 111 | action="store", dest="output_directory", default=None, |
| 112 | 112 | 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 | + | |
| 113 | 122 | parser.add_option("-v","--verbose", |
| 114 | 123 | action="store_true", dest="verbose", default=True, |
| 115 | 124 | help="make lots of noise [default]") |
| @@ -165,9 +174,18 @@ if __name__ == '__main__': · 49 unmodified lines | ||
| 165 | 174 | |
| 166 | 175 | # cutting pass |
| 167 | 176 | if options.cut and nstamps > 0: |
| 168 | − # generate output filenames | |
| 177 | + # generate output files | |
| 169 | 178 | 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, | |
| 171 | 189 | output_dir = options.output_directory) |
| 172 | 190 | |
| 173 | 191 | # print some info |