Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -180,12 +180,14 @@ if st.sidebar.button('Generate My Music'):
|
|
180 |
with st.spinner('✨ Your music is now under processing... ✨'):
|
181 |
time.sleep(10) # Simulate processing time
|
182 |
generate(10, len_notes)
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
|
|
|
|
189 |
else:
|
190 |
# Fallback to the default value if no selection is made
|
191 |
with st.container():
|
@@ -194,10 +196,11 @@ if st.sidebar.button('Generate My Music'):
|
|
194 |
with st.spinner('✨ Your music is now under processing... ✨'):
|
195 |
time.sleep(10) # Simulate processing time
|
196 |
generate(10, default_len_notes)
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
|
|
|
180 |
with st.spinner('✨ Your music is now under processing... ✨'):
|
181 |
time.sleep(10) # Simulate processing time
|
182 |
generate(10, len_notes)
|
183 |
+
if shutil.which("fluidsynth") is None:
|
184 |
+
st.error("FluidSynth is not available. Unable to convert MIDI to audio.")
|
185 |
+
else:
|
186 |
+
fs = FluidSynth('font.sf2', sample_rate=44100)
|
187 |
+
fs.midi_to_audio('test_output2.mid', 'output.wav')
|
188 |
+
st.audio('output.wav')
|
189 |
+
st.markdown("Here you are! You can download your music by right-clicking on the media player.")
|
190 |
+
|
191 |
else:
|
192 |
# Fallback to the default value if no selection is made
|
193 |
with st.container():
|
|
|
196 |
with st.spinner('✨ Your music is now under processing... ✨'):
|
197 |
time.sleep(10) # Simulate processing time
|
198 |
generate(10, default_len_notes)
|
199 |
+
if shutil.which("fluidsynth") is None:
|
200 |
+
st.error("FluidSynth is not available. Unable to convert MIDI to audio.")
|
201 |
+
else:
|
202 |
+
fs = FluidSynth('font.sf2', sample_rate=44100)
|
203 |
+
fs.midi_to_audio('test_output2.mid', 'output.wav')
|
204 |
+
st.audio('output.wav')
|
205 |
+
st.markdown("Here you are! You can download your music by right-clicking on the media player.")
|
206 |
+
|