Showing the changes to python/scripts (1 of 1 file). Show all
Unified · Split
| @@ -106,6 +106,10 @@ def parse_args(): · 105 unmodified lines | ||
| 106 | 106 | action="store_true", dest="spectro", default=False, |
| 107 | 107 | help="add spectrogram to the plot") |
| 108 | 108 | """ |
| 109 | + parser.add_option("-o","--output", type = str, | |
| 110 | + metavar = "<outputdir>", | |
| 111 | + action="store", dest="output_directory", default=None, | |
| 112 | + help="specify path where slices of the original file should be created") | |
| 109 | 113 | parser.add_option("-v","--verbose", |
| 110 | 114 | action="store_true", dest="verbose", default=True, |
| 111 | 115 | help="make lots of noise [default]") |
| @@ -164,6 +168,10 @@ if __name__ == '__main__': · 52 unmodified lines | ||
| 164 | 168 | # generate output filenames |
| 165 | 169 | import os |
| 166 | 170 | source_base_name, source_ext = os.path.splitext(os.path.basename(source_file)) |
| 171 | + if options.output_directory != None: | |
| 172 | + if not os.path.isdir(options.output_directory): | |
| 173 | + os.makedirs(options.output_directory) | |
| 174 | + source_base_name = os.path.join(options.output_directory, source_base_name) | |
| 167 | 175 | def new_sink_name(source_base_name, timestamp): |
| 168 | 176 | return source_base_name + '_%02.3f' % (timestamp) + '.wav' |
| 169 | 177 | # reopen source file |