File size: 594 Bytes
a931541
 
ff647b0
 
 
1de73a8
789718b
ff647b0
 
1de73a8
 
 
 
ff647b0
c7cb9a5
 
 
 
ff647b0
c7cb9a5
a931541
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import gradio as gr

# from musicautobot.numpy_encode import file2stream
from musicautobot.utils.setup_musescore import play_wav
from music21.midi.translate import midiFileToStream
from pathlib import Path
from midi2audio import FluidSynth

def process_midi(midi_file):
    name = Path(midi_file.name)
#     stream = midiFileToStream(midi_file)
#     output_wav = play_wav(stream)
    FluidSynth("../usr/share/sounds/sf2/FluidR3_GM.sf2").midi_to_audio(name, 'test.wav')
    return output_wav

iface = gr.Interface(
    fn=process_midi, 
    inputs="file", 
    outputs="audio"
)

iface.launch()