History

[py] [slicing] add option create_first, default to False

Paul Brossier committed 8 years ago

Commit c9c012e1 parent a88594d1 file · +4 −3Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/lib/aubio/slicing.py+4−3
@@ -6,13 +6,14 @@ from aubio import source, sink · 5 unmodified lines
66 _max_timestamp = 1e120
77
88 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):
1011 """ slice a sound file at given timestamps """
1112
1213 if timestamps is None or len(timestamps) == 0:
1314 raise ValueError("no timestamps given")
1415
15− if timestamps[0] != 0:
16+ if timestamps[0] != 0 and create_first:
1617 timestamps = [0] + timestamps
1718 if timestamps_end is not None:
1819 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
7778 if remaining > start:
7879 # write remaining samples from current region
7980 _sink.do_multi(vec[:, start:remaining], remaining - start)
80− #print "closing region", "remaining", remaining
81+ #print("closing region", "remaining", remaining)
8182 # close this file
8283 _sink.close()
8384 elif read > start:

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t