mingus python_python – 不能用mingus播放音符

我来使用mingus试图在

python中重现一些音符.基于

answered here,我尝试过:

from mingus.midi import fluidsynth

fluidsynth.init('/home/btc/Escritorio/SinestesiaRCB/gfx/ViolinsLong.sf2',"alsa")

fluidsynth.play_Note(64,0,100)

#Also tried with Note("C-5") and so forth

fluidsynth: warning: Failed to set thread to high priority

fluidsynth: warning: No preset found on channel 9 [bank=128 prog=0]

For General MIDI compatibility, the default sound font instrument

assignments are bank 0, program 0 (“Acoustic Grand Piano”) for

channels 0–8 and 10–15, and bank 128, program 0 (“Default Drum Set”)

for channel 9. Apparently, your sound font does not have the latter.

This does not matter if your MIDI file does not assume General MIDI

compatible instruments and does not try to play drum sounds on channel

9.

但除此之外,这可能会让事情变得更加清晰,我仍然不知道如何解决它.

另外,如果我使用same file作为第一个链接的答案,那么我得到的错误是这个(并且不知道如何解决它):

fluidsynth: warning: Failed to set thread to high priority

fluidsynth: warning: Failed to pin the sample data to RAM; swapping is possible.

更新

使用sudo权限运行程序会删除此错误,但它不会发出声音.这样,我得到的错误是:

QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to ‘/tmp/runtime-root’

我认为在fluidynth驱动程序中选择的驱动程序模式可能存在问题,但我已尝试使用相同的结果(alsa,oss等).为了完整起见,我在VM中运行它,其中的其他声音在我的主机扬声器中正确再现.

但是基于this answer,我想它应该通过传递给它正确的声音环境变量来解决.我不知道.我尝试过:

pkexec env DISPLAY=$DISPLAY XAUTHORITY=$XAUTHORITY python3 /home/btc/Escritorio/SinestesiaRCB/SinestesiaRCB.py

需要文件的完整路径,因为这需要sudo权限并更改其工作目录,最后出现相同的错误:XDG_RUNTIME_DIR.

更新2

如果我使用sudo -E选项运行它,错误将替换为新错误:

QStandardPaths: wrong ownership on runtime directory /run/user/1000, 1000 instead of 0

我正在阅读in some webs,1000用户应该是默认用户而不是root用户.

因此,我做了一个:

sudo chown root:root /run/user/1000

只是尝试,然后应用程序运行没有失败,但它仍然没有响.

更新3

基于this example和this Q&A,我已经尝试了两次使用时间睡眠,并且在播放play_note之后(也在之前)使用raw_input,但它仍然没有发出声音.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值