Spaces:
Sleeping
Sleeping
Liam Pond
commited on
Commit
·
2528c00
1
Parent(s):
6a58552
Testing a fix for broken tempo slider
Browse files
app.py
CHANGED
|
@@ -321,6 +321,28 @@ if filetype == "MEI":
|
|
| 321 |
st.header("2. Edit Phonemes, Durations, and Pitches")
|
| 322 |
updated_syllables = []
|
| 323 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 324 |
for idx, group in enumerate(st.session_state.edited_syllables):
|
| 325 |
st.markdown(f"#### {group['syllable'].capitalize()}")
|
| 326 |
new_phonemes = []
|
|
|
|
| 321 |
st.header("2. Edit Phonemes, Durations, and Pitches")
|
| 322 |
updated_syllables = []
|
| 323 |
|
| 324 |
+
if "previous_tempo" not in st.session_state:
|
| 325 |
+
st.session_state.previous_tempo = tempo
|
| 326 |
+
|
| 327 |
+
if tempo != st.session_state.previous_tempo:
|
| 328 |
+
for i, note in enumerate(st.session_state.original_raw_notes):
|
| 329 |
+
updated = split_syllable(
|
| 330 |
+
syllable=note["lyric"],
|
| 331 |
+
note_duration=note["duration"],
|
| 332 |
+
tempo=tempo,
|
| 333 |
+
pitch=note["pitch"]
|
| 334 |
+
)
|
| 335 |
+
# preserve existing phoneme values (if possible)
|
| 336 |
+
for j, ph in enumerate(updated):
|
| 337 |
+
try:
|
| 338 |
+
existing = st.session_state.edited_syllables[i]["phonemes"][j]
|
| 339 |
+
ph["phoneme"] = existing["phoneme"]
|
| 340 |
+
ph["pitch"] = existing["pitch"]
|
| 341 |
+
except IndexError:
|
| 342 |
+
pass # new phoneme or longer split
|
| 343 |
+
st.session_state.edited_syllables[i]["phonemes"] = updated
|
| 344 |
+
st.session_state.previous_tempo = tempo
|
| 345 |
+
|
| 346 |
for idx, group in enumerate(st.session_state.edited_syllables):
|
| 347 |
st.markdown(f"#### {group['syllable'].capitalize()}")
|
| 348 |
new_phonemes = []
|