Commit c63b451e authored by Anthony Larcher's avatar Anthony Larcher
Browse files
parents 83a75e72 75570a57
......@@ -603,14 +603,10 @@ class IdMapSet(Dataset):
stop = int(self.idmap.stop[index])
# add this in case the segment is too short
if stop - start <= self.min_duration * nfo.samplerate:
print("Segment trop court")
print(f"Get: {stop - start} and need {self.min_duration * nfo.samplerate}")
print(f"self.min_duration = {self.min_duration}, nfo.samplerate = {nfo.samplerate}")
print(f"start = {start}, stop = {stop}\t start//160 {start//160}, stop {stop//160}")
middle = (stop - start) // 2
middle = start + (stop - start) // 2
start = max(0, int(middle - (self.min_duration * nfo.samplerate / 2)))
stop = int(start + self.min_duration * nfo.samplerate)
print(f"Apres modification: start = {start}, stop = {stop} total duration: {stop - start}")
sig, _ = soundfile.read(f"{self.data_root_path}/{self.idmap.rightids[index]}.{self.file_extension}",
start=start,
stop=stop)
......@@ -619,7 +615,6 @@ class IdMapSet(Dataset):
if self.transform_pipeline is not None:
sig, _, ___, _____, _t, _s = self.transforms((sig, 0, 0, 0, 0, 0))
return torch.from_numpy(sig).type(torch.FloatTensor), \
self.idmap.leftids[index], \
self.idmap.rightids[index], \
......
Supports Markdown
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