Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ from keras.layers import *
|
|
| 9 |
from midi2audio import FluidSynth
|
| 10 |
import shutil
|
| 11 |
import pretty_midi
|
|
|
|
| 12 |
|
| 13 |
def midi_to_audio(midi_file, output_file):
|
| 14 |
# Load the MIDI file
|
|
@@ -18,7 +19,7 @@ def midi_to_audio(midi_file, output_file):
|
|
| 18 |
audio_data = midi_data.synthesize()
|
| 19 |
|
| 20 |
# Save to a WAV file
|
| 21 |
-
|
| 22 |
|
| 23 |
####################### Music Generation Functions #######################
|
| 24 |
def generate(seq_len,x):
|
|
|
|
| 9 |
from midi2audio import FluidSynth
|
| 10 |
import shutil
|
| 11 |
import pretty_midi
|
| 12 |
+
import soundfile as sf
|
| 13 |
|
| 14 |
def midi_to_audio(midi_file, output_file):
|
| 15 |
# Load the MIDI file
|
|
|
|
| 19 |
audio_data = midi_data.synthesize()
|
| 20 |
|
| 21 |
# Save to a WAV file
|
| 22 |
+
sf.write(output_file, audio_data, 44100)
|
| 23 |
|
| 24 |
####################### Music Generation Functions #######################
|
| 25 |
def generate(seq_len,x):
|