diff --git a/autosyl/assUtils.py b/autosyl/assUtils.py index a9c4444d8fe5f2adcd5b8c7654d184e0c5678dea..9843d045bf1cb2b17755c7515753ecef5ddf2c27 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 8b6328384a4edc5c009b84ef79d00f6e8a8b2a4e..649b1f1c38823cb3efd9342aec63e2d576ac7681 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)