【问题标题】:midi2audio/FluidSynth: [WinError 2] The system cannot find the file specifiedmidi2audio/FluidSynth: [WinError 2] 系统找不到指定的文件
【发布时间】:2018-06-03 04:56:58
【问题描述】:

我正在使用 python 包 midi2audio 将 midi 文件转换为 WAV。

跑步:

filepath = 'C:/Users/Jack/Documents/GaTech/Research/Code/Data/Midi/C4/test12.mid'
soundfont = 'C:/Users/Jack/Downloads/weedsgm3.sf2'    
fs = FluidSynth(soundfont)


if os.path.isfile(filepath):
   print('The File Exists')
else: 
   print('The File does not exist')

fs.midi_to_audio(filepath, 'output.wav')

输出:

The File Exists
FileNotFoundError: [WinError 2] The system cannot find the file specified

需要明确的是,错误是引用文件路径中指定的文件而不是 soundfont。包装上的文档很少,所以我不知道该怎么做。

有没有使用 midi2audio 经验的人遇到过同样的问题并知道问题的根源是什么?

【问题讨论】:

  • filepath的实际值是多少?
  • 我添加了包含文件路径的完整代码

标签: python-3.x midi audio-converter fluidsynth


【解决方案1】:
fs = FluidSynth()

这将创建一个FluidSynth 对象,其中所有构造函数的参数都具有默认值。

FluidSynth(sample_rate=22050)

这会创建第二个FluidSynth 对象。对象引用没有分配给任何变量,所以它被立即丢弃。

FluidSynth(soundfont)

还有第三个对象。

fs.midi_to_audio(filepath, 'output.wav')

fs 引用的对象使用默认的声音字体和默认的采样率。

你必须一次将所有参数给构造函数:

fs = FluidSynth(sound_font=soundfont, sample_rate=22050)

(最好指定输出文件的完整路径。)

【讨论】:

  • 嘿,即使我尝试使用默认的 sample_rate 和 soundfont,我也会收到此错误...还尝试使用输入和输出的绝对路径,但无济于事。任何有关如何解决此问题的帮助将不胜感激。
  • @AnselD'souza 要提问,请使用“”按钮。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-21
  • 1970-01-01
  • 1970-01-01
  • 2021-05-29
  • 2021-07-14
相关资源
最近更新 更多