ref: c9c012e61e07a5e4b1fe44e70bab45dc34ff7d5a
parent: a88594d54be34baa13566a417ed8b358eea439cd
author: Paul Brossier <piem@piem.org>
date: Mon Oct 29 11:32:24 EDT 2018
[py] [slicing] add option create_first, default to False
--- a/python/lib/aubio/slicing.py
+++ b/python/lib/aubio/slicing.py
@@ -6,13 +6,14 @@
_max_timestamp = 1e120
def slice_source_at_stamps(source_file, timestamps, timestamps_end=None,
- output_dir=None, samplerate=0, hopsize=256):
+ output_dir=None, samplerate=0, hopsize=256,
+ create_first=False):
""" slice a sound file at given timestamps """
if timestamps is None or len(timestamps) == 0:
raise ValueError("no timestamps given")
- if timestamps[0] != 0:
+ if timestamps[0] != 0 and create_first:
timestamps = [0] + timestamps
if timestamps_end is not None:
timestamps_end = [timestamps[1] - 1] + timestamps_end
@@ -77,7 +78,7 @@
if remaining > start:
# write remaining samples from current region
_sink.do_multi(vec[:, start:remaining], remaining - start)
- #print "closing region", "remaining", remaining
+ #print("closing region", "remaining", remaining)
# close this file
_sink.close()
elif read > start: