Showing the changes to python (1 of 1 file). Show all
Unified · Split
| @@ -6,13 +6,14 @@ from aubio import source, sink · 5 unmodified lines | ||
| 6 | 6 | _max_timestamp = 1e120 |
| 7 | 7 | |
| 8 | 8 | def slice_source_at_stamps(source_file, timestamps, timestamps_end=None, |
| 9 | − output_dir=None, samplerate=0, hopsize=256): | |
| 9 | + output_dir=None, samplerate=0, hopsize=256, | |
| 10 | + create_first=False): | |
| 10 | 11 | """ slice a sound file at given timestamps """ |
| 11 | 12 | |
| 12 | 13 | if timestamps is None or len(timestamps) == 0: |
| 13 | 14 | raise ValueError("no timestamps given") |
| 14 | 15 | |
| 15 | − if timestamps[0] != 0: | |
| 16 | + if timestamps[0] != 0 and create_first: | |
| 16 | 17 | timestamps = [0] + timestamps |
| 17 | 18 | if timestamps_end is not None: |
| 18 | 19 | timestamps_end = [timestamps[1] - 1] + timestamps_end |
| @@ -77,7 +78,7 @@ def slice_source_at_stamps(source_file, timestamps, timestamps_end=None, · 58 unmodified lines | ||
| 77 | 78 | if remaining > start: |
| 78 | 79 | # write remaining samples from current region |
| 79 | 80 | _sink.do_multi(vec[:, start:remaining], remaining - start) |
| 80 | − #print "closing region", "remaining", remaining | |
| 81 | + #print("closing region", "remaining", remaining) | |
| 81 | 82 | # close this file |
| 82 | 83 | _sink.close() |
| 83 | 84 | elif read > start: |