- Fix end time smaller than start time caused by hyphen enumaration issue

This commit is contained in:
Vadim committed 2023-06-10 21:25:35 +02:00
1 parent 376db08a5d
commit ab9d4338cc
2 files changed
+4 -8

No files matched your search

+4 -3
View File
@@ -118,14 +118,15 @@ def add_hyphen_to_data(transcribed_data: list[TranscribedData], hyphen_words: li
chunk_duration = chunk_duration / (len(hyphen_words[i]))
next_start = data.start
for j, hyphens in enumerate(hyphen_words[i]):
for j in enumerate(hyphen_words[i]):
hyphenated_word_index = j[0]
dup = copy.copy(data)
dup.start = next_start
next_start = data.end - chunk_duration * (
len(hyphens) - 1 - j
len(hyphen_words[i]) - 1 - hyphenated_word_index
)
dup.end = next_start
dup.word = hyphen_words[i][j]
dup.word = hyphen_words[i][hyphenated_word_index]
dup.is_hyphen = True
new_data.append(dup)
-5
View File
@@ -108,11 +108,6 @@ def create_midi_note_from_pitched_data(start_time: float, end_time: float, pitch
start = find_nearest_index(pitched_data.times, start_time)
end = find_nearest_index(pitched_data.times, end_time)
# fixme: why is end smaller as start?
if end < start:
print(f"{ULTRASINGER_HEAD} {red_highlighted('Error: end time is smaller as start time. The note is C0 now ...')}")
return "C0"
if start == end:
freqs = [pitched_data.frequencies[start]]
confs = [pitched_data.confidence[start]]