Skip to main content
 首页 » 编程设计

python之Pyfluidsynth 错误

2025年05月04日23lvdongjie

我正在尝试启动并运行 pyfluidsynth。问题是我什至无法运行下载页面上提供的示例代码。相关代码如下:

import time 
import fluidsynth 
 
fs = fluidsynth.Synth() 
fs.start() 
 
sfid = fs.sfload("example.sf2") 
fs.program_select(0, sfid, 0, 0) 
 
fs.noteon(0, 60, 30) 
fs.noteon(0, 67, 30) 
fs.noteon(0, 76, 30) 
 
time.sleep(1.0) 
 
fs.noteoff(0, 60) 
fs.noteoff(0, 67) 
fs.noteoff(0, 76) 
 
time.sleep(1.0) 
 
fs.delete() 

不太确定问题出在哪里 - 据我所知,我安装了所有依赖项,但没有安装。按照错误消息:

Cannot connect to server socket err = No such file or directory 
Cannot connect to server socket 
jackdmp 1.9.7 
Copyright 2001-2005 Paul Davis and others. 
Copyright 2004-2010 Grame. 
jackdmp comes with ABSOLUTELY NO WARRANTY 
This is free software, and you are welcome to redistribute it 
under certain conditions; see the file COPYING for details 
Cannot create thread 1 Operation not permitted 
Cannot create thread 1 Operation not permitted 
JACK server starting in realtime mode with priority 10 
Cannot lock down memory area (Cannot allocate memory) 
control device hw:0 
control device hw:0 
audio_reservation_init 
Acquire audio card Audio0 
creating alsa driver ... hw:0|hw:0|1024|2|48000|0|0|nomon|swmeter|-|32bit 
control device hw:0 
Using ALSA driver HDA-Intel running on card 0 - HDA Intel at 0xf4800000 irq 47 
configuring for 48000Hz, period = 1024 frames (21.3 ms), buffer = 2 periods 
ALSA: final selected sample format for capture: 32bit integer little-endian 
ALSA: use 2 periods for capture 
ALSA: final selected sample format for playback: 32bit integer little-endian 
ALSA: use 2 periods for playback 
Cannot use real-time scheduling (RR/10)(1: Operation not permitted) 
AcquireSelfRealTime error 
Cannot lock down memory area (Cannot allocate memory) 
Cannot use real-time scheduling (RR/5)(1: Operation not permitted) 
AcquireRealTime error 
fluidsynth: Jack sample rate mismatch, adjusting. (synth.sample-rate=44100, jackd=48000) 
fluidsynth: warning: Failed to pin the sample data to RAM; swapping is possible. 
JackEngine::XRun: client = fluidsynth was not run: state = 2 
JackAudioDriver::ProcessGraphAsync: Process error 
JackActivationCount::Signal value = 0 ref = 2 
JackTemporaryException : now quits... 
jack main caught signal 2 

有什么想法吗?

请您参考如下方法:

在这里查看解决方案:PyAudio working, but spits out error messages each time ,尤其是 Nils Werner 提供的脚本。

它对我有用,除了我继续遇到以下 3 个错误: “无法连接到服务器套接字错误 = 没有这样的文件或目录 无法连接到服务器请求 channel jack 服务器未运行或无法启动”