From 3b8065048bc33d46138913333d001e6a264f677f Mon Sep 17 00:00:00 2001 From: Sting <lallegre26@gmail.com> Date: Fri, 21 Jul 2023 00:26:20 +0200 Subject: [PATCH] Fix --- autosyl/assUtils.py | 2 +- autosyl/segment.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/autosyl/assUtils.py b/autosyl/assUtils.py index a9c4444..9843d04 100644 --- a/autosyl/assUtils.py +++ b/autosyl/assUtils.py @@ -33,7 +33,7 @@ def getSyls(ass_file): syl_line = [] lastTime = dateToTime(line[0]) for couple in RGX_TAGS.findall(line[2]): - if(couple[1] != ''): + if(couple[1] != '' and not couple[1].isspace()): syl_line.append([lastTime, couple[1], int(couple[0])]) lastTime += int(couple[0]) syl_line.append([lastTime, '', 0]) diff --git a/autosyl/segment.py b/autosyl/segment.py index 8b63283..649b1f1 100644 --- a/autosyl/segment.py +++ b/autosyl/segment.py @@ -44,9 +44,9 @@ def segment(songfile, reference_syls=None, syls_per_line=10, last_syl_dur=500): words_onsets = np.array([word_align[i][0] for i in range(len(word_align))]) + print(words_onsets) - - + ''' cnn = madmom.features.onsets.CNNOnsetProcessor() spectral = madmom.features.onsets.SpectralOnsetProcessor('modified_kullback_leibler') @@ -125,6 +125,7 @@ def segment(songfile, reference_syls=None, syls_per_line=10, last_syl_dur=500): initial_onset = onsets[i] while(activation_smoothed[onsets[i] - 1] < activation_smoothed[onsets[i]] and onsets[i] > initial_onset - backtrack_max_frames): onsets[i] -= 1 + ''' onsets = words_onsets onsets = (onsets + delay)/100 @@ -135,7 +136,7 @@ def segment(songfile, reference_syls=None, syls_per_line=10, last_syl_dur=500): onset_index = 0 for line in reference_syls: #print(onset_index, " : ", line) - l = [[onsets[onset_index + i], line[i][1]] for i in range(len(line)-1)] + l = [[onsets[onset_index + i], words[onset_index + i]] for i in range(len(line)-1)] l.append([line[-1][0]/100, '']) syls.append(l) onset_index += (len(line) - 1) -- GitLab