Simon Stolarczyk commited on
Commit
1de73a8
1 Parent(s): ff647b0

Simple playback, take 2.

Browse files
.ipynb_checkpoints/app-checkpoint.py CHANGED
@@ -3,10 +3,13 @@ import gradio as gr
3
  # from musicautobot.numpy_encode import file2stream
4
  from musicautobot.utils.setup_musescore import play_wav
5
  from music21.midi.translate import midiFileToStream
 
6
 
7
  def process_midi(midi_file):
8
- stream = midiFileToStream(midi_file)
9
- output_wav = play_wav(stream)
 
 
10
  return output_wav
11
 
12
  iface = gr.Interface(
 
3
  # from musicautobot.numpy_encode import file2stream
4
  from musicautobot.utils.setup_musescore import play_wav
5
  from music21.midi.translate import midiFileToStream
6
+ from pathlib import Path
7
 
8
  def process_midi(midi_file):
9
+ name = Path(midi_file.name)
10
+ # stream = midiFileToStream(midi_file)
11
+ # output_wav = play_wav(stream)
12
+ FluidSynth("../usr/share/sounds/sf2/FluidR3_GM.sf2").midi_to_audio(name, 'test.wav')
13
  return output_wav
14
 
15
  iface = gr.Interface(
.ipynb_checkpoints/package-checkpoint.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fluid-soundfont-gm
2
+ fluid-soundfont-gs
3
+ fluidsynth
app.py CHANGED
@@ -3,10 +3,13 @@ import gradio as gr
3
  # from musicautobot.numpy_encode import file2stream
4
  from musicautobot.utils.setup_musescore import play_wav
5
  from music21.midi.translate import midiFileToStream
 
6
 
7
  def process_midi(midi_file):
8
- stream = midiFileToStream(midi_file)
9
- output_wav = play_wav(stream)
 
 
10
  return output_wav
11
 
12
  iface = gr.Interface(
 
3
  # from musicautobot.numpy_encode import file2stream
4
  from musicautobot.utils.setup_musescore import play_wav
5
  from music21.midi.translate import midiFileToStream
6
+ from pathlib import Path
7
 
8
  def process_midi(midi_file):
9
+ name = Path(midi_file.name)
10
+ # stream = midiFileToStream(midi_file)
11
+ # output_wav = play_wav(stream)
12
+ FluidSynth("../usr/share/sounds/sf2/FluidR3_GM.sf2").midi_to_audio(name, 'test.wav')
13
  return output_wav
14
 
15
  iface = gr.Interface(
package.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ fluid-soundfont-gm
2
+ fluid-soundfont-gs
3
+ fluidsynth
requirements.txt CHANGED
@@ -1,4 +1,5 @@
1
  musicautobot
2
  fastai==1.0.61
3
  music21
4
- pebble
 
 
1
  musicautobot
2
  fastai==1.0.61
3
  music21
4
+ pebble
5
+ midi2audio