0

Trying to make a part of a program where a MIDI file is converted to a different file type. Here's an example of code that doesn't work:

from midi2audio import FluidSynth
midfile = "F:\\ai nea\\Actual Project\\"+input()
output = "F:\\ai nea\\Actual Project\\output.mp3"
soundfont= "F:\\ai nea\\Actual Project\\FluidR3 GM.sf2"
fs = FluidSynth(sound_font=soundfont)
fs.midi_to_audio(midfile,output)

and this is the exception:

Traceback (most recent call last):
  File "F:/ai nea/Actual Project/contest.py", line 6, in <module>
    fs.midi_to_audio(midfile,output)
  File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\site-packages\midi2audio.py", line 46, in midi_to_audio
    subprocess.call(['fluidsynth', '-ni', self.sound_font, midi_file, '-F', audio_file, '-r', str(self.sample_rate)])
  File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 339, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 800, in __init__
    restore_signals, start_new_session)
  File "C:\Users\Will\AppData\Local\Programs\Python\Python37\lib\subprocess.py", line 1207, in _execute_child
    startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

Any ideas?

Will
  • 25
  • 6

1 Answers1

0

Your program "fluidsynth.exe" could not be found. You may fix this issue putting the location of the program in your PATH environment variable.

Former contributor
  • 2,466
  • 2
  • 10
  • 15