Я получаю ошибку FileNotFoundError при попытке вызвать midi2audio.Я работаю с Python 3.6 - Anaconda - Windows 10. Мой файл .py находится в той же папке вместе с файлами .sf2 и .mid.Мой код:
from midiutil.MidiFile import MIDIFile
from midi2audio import FluidSynth
soundfont = 'C:\\Users\\matteo.stante\\Documents\\4_Python_Scripts\\experiments\\JR_sax.sf2'
filepath = 'C:\\Users\\matteo.stante\\Documents\\4_Python_Scripts\\experiments\\input.mid'
fs = FluidSynth(sound_font=soundfont, sample_rate=22050)
fs.midi_to_audio(filepath, 'output.wav')
Я ожидаю, что файл WAV в моей папке будет создан.Я получаю вместо:
runfile('C:/Users/matteo.stante/Documents/4_Python_Scripts/experiments/AudioBello.py', wdir='C:/Users/matteo.stante/Documents/4_Python_Scripts/experiments')
Traceback (most recent call last):
File "<ipython-input-43-cdda6b922219>", line 1, in <module>
runfile('C:/Users/matteo.stante/Documents/4_Python_Scripts/experiments/AudioBello.py', wdir='C:/Users/matteo.stante/Documents/4_Python_Scripts/experiments')
File "C:\Users\matteo.stante\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)
File "C:\Users\matteo.stante\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/matteo.stante/Documents/4_Python_Scripts/experiments/AudioBello.py", line 26, in <module>
fs.midi_to_audio(filepath, 'output.wav')
File "C:\Users\matteo.stante\AppData\Local\Continuum\anaconda3\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\matteo.stante\AppData\Local\Continuum\anaconda3\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\matteo.stante\AppData\Local\Continuum\anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 210, in __init__
super(SubprocessPopen, self).__init__(*args, **kwargs)
File "C:\Users\matteo.stante\AppData\Local\Continuum\anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "C:\Users\matteo.stante\AppData\Local\Continuum\anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] Impossibile trovare il file specificato