Commit 6ebc4ab4 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

differnt durations

parent c5afedbc
......@@ -259,6 +259,7 @@ def process_segment_label(label,
def seqSplit(mdtm_dir,
wav_dir,
duration=2.):
"""
......@@ -279,17 +280,20 @@ def seqSplit(mdtm_dir,
# Get the borders of the segments (not the start of the first and not the end of the last
# Check the length of audio
nfo = soundfile.info(wav_dir + mdtm_file[len(mdtm_dir):].split(".")[0] + ".wav")
# For each border time B get a segment between B - duration and B + duration
# in which we will pick up randomly later
for idx, seg in enumerate(ref.segments):
if idx > 0 and seg["start"] / 100. > duration and seg["start"] + duration < last_stop:
if seg["start"] / 100. > (duration / 2.) and seg["start"] + (duration / 2.) < nfo.duration:
segment_list.append(show=seg['show'],
cluster="",
start=float(seg["start"]) / 100. - duration,
stop=float(seg["start"]) / 100. + duration)
elif idx < len(ref.segments) - 1 and seg["stop"] + duration < last_stop:
if seg["stop"] / 100. > (duration / 2.) and seg["stop"] + (duration / 2.) < nfo.duration:
segment_list.append(show=seg['show'],
cluster="",
cluster="",
start=float(seg["stop"]) / 100. - duration,
stop=float(seg["stop"]) / 100. + duration)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment