如何在 Windows 10 上安装流体合成器或 pyfluidsynth? AttributeError:模块“fluidsynth”没有属性“Synth”

Posted

技术标签:

【中文标题】如何在 Windows 10 上安装流体合成器或 pyfluidsynth? AttributeError:模块“fluidsynth”没有属性“Synth”【英文标题】:Does anyone know how to install fluidsynth or pyfluidsynth on windows 10? AttributeError: module 'fluidsynth' has no attribute 'Synth'有谁知道 【发布时间】:2020-05-13 09:31:19 【问题描述】:

为了让 magenta.music 函数 play_sequence(note_seq,synth=mm.fluidsynth) 播放音符序列并将其显示在我的 jupyter 笔记本上,我已经尝试在 Windows 10 上安装了很多次流体合成和 pyfluidsynth。

我尝试克隆 github 存储库,使用 pip 安装它,但似乎没有任何效果。我检查了 Synth 类是否在我的 fluidsynth.py 脚本中,我发现了它,所以我不知道问题出在哪里。

我得到的错误是这个:


AttributeError Traceback(最近一次调用最后一次) 在 2 #MIDI 文件来自原始音高曲线 3 文件 = 'midi ----> 4 midi_pianoroll(文件) 5 play_midi(file + '.mid')

在 midi_pianoroll(file_prefix) 16 17 # 这是一个播放 NoteSequence 的 colab 实用方法。 ---> 18 mm.play_sequence(note_seq,synth=mm.fluidsynth) 19 返回 20

~\Anaconda3\lib\site-packages\magenta\music\notebook_utils.py in play_sequence(sequence, synth, sample_rate, colab_ephemeral, **synth_args) 99 **synth_args:传递给合成函数的附加关键字参数。 100 """ --> 101 array_of_floats = synth(sequence, sample_rate=sample_rate, **synth_args) 102 103尝试:

~\Anaconda3\lib\site-packages\magenta\music\midi_synth.py in fluidsynth(sequence, sample_rate, sf2_path) 53 """ 54 midi = midi_io.note_sequence_to_pretty_midi(序列) ---> 55 返回 midi.fluidsynth(fs=sample_rate, sf2_path=sf2_path)

~\Anaconda3\lib\site-packages\pretty_midi\pretty_midi.py in fluidsynth(self, fs, sf2_path) 916 # 获取每个仪器的合成波形 917 个波形 = [i.fluidsynth(fs=fs, --> 918 sf2_path=sf2_path) for i in self.instruments] 919 # 分配输出波形,#sample = 所有波形的最大长度 920 合成 = np.zeros(np.max([w.shape[0] for w in波形]))

~\Anaconda3\lib\site-packages\pretty_midi\pretty_midi.py in (.0) 916 # 获取每个仪器的合成波形 917 个波形 = [i.fluidsynth(fs=fs, --> 918 sf2_path=sf2_path) for i in self.instruments] 919 # 分配输出波形,#sample = 所有波形的最大长度 920 合成 = np.zeros(np.max([w.shape[0] for w in波形]))

~\Anaconda3\lib\site-packages\pretty_midi\instrument.py in fluidsynth(self, fs, sf2_path) 426 427 # 创建流体合成实例 --> 428 fl =流体合成器。合成器(采样率=fs) 第429章 430 sfid = fl.sfload(sf2_path)

AttributeError: 模块 'fluidsynth' 没有属性 'Synth'

【问题讨论】:

【参考方案1】:

我现在正在尝试这里的说明: https://ksvi.mff.cuni.cz/~dingle/2019/prog_1/python_music.html

包裹在这里: https://github.com/FluidSynth/fluidsynth/releases/tag/v2.1.0.rc1

【讨论】:

以上是关于如何在 Windows 10 上安装流体合成器或 pyfluidsynth? AttributeError:模块“fluidsynth”没有属性“Synth”的主要内容,如果未能解决你的问题,请参考以下文章

如何使用流体合成器从 C# 中的声音字体生成声音

python用fluidsynth合成midi

流体合成声音字体选择不持久

PyGame 更改预设声音字体

如何在没有 Git Bash 或 GUI 的情况下在 Windows 10 上安装 git?

如何在Windows 10上安装.Appx或.AppxBundle软件