作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我在没有 jack 的 Ubuntu 14.04 上安装 pyo 并运行 Python 2.7。我遵循 Debian-based installing instructions写在 pyo wiki 上。
这是我使用的代码(在 pyo introduction page 中):
from pyo import *
s = Server().boot()
s.start()
a = Sine(mul=0.01).out()
pyo version 0.6.8 (uses single precision)
ALSA lib pcm_dsnoop.c:618:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
bt_audio_service_open: connect() failed: Connection refused (111)
ALSA lib pcm_dmix.c:1022:(snd_pcm_dmix_open) unable to open slave
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
Expression 'parameters->channelCount <= maxChans' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 1514
Expression 'ValidateParameters( inputParameters, hostApi, StreamDirection_In )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 2818
portaudio error in Pa_OpenStream: Invalid number of channels
Portaudio error: Invalid number of channels
Server not booted.
The Server must be booted!
Traceback (most recent call last):
File "/host/Python/Synth/synther.py", line 4, in <module>
a = Sine(mul=0.01).out()
File "/usr/lib/python2.7/dist-packages/pyolib/generators.py", line 58, in __init__
PyoObject.__init__(self, mul, add)
File "/usr/lib/python2.7/dist-packages/pyolib/_core.py", line 376, in __init__
PyoObjectBase.__init__(self)
File "/usr/lib/python2.7/dist-packages/pyolib/_core.py", line 262, in __init__
raise PyoServerStateException("The Server must be booted before creating any audio object.")
pyolib._core.PyoServerStateException: The Server must be booted before creating any audio object.
最佳答案
可以在 Ubuntu 20.04 上运行
在尝试了几件事和很多挫折之后......以下工作:
sudo apt install python3-pyo
和测试:
#/usr/bin/env python3
from pyo import *
s = Server()
s.boot()
s.start()
a = Sine(freq=440, mul=0.5)
a.out()
time.sleep(2)
a.stop()
s.stop()
根据需要产生 2 秒 440Hz 的正弦波。也许需要重新启动。
sudo apt install python3-wxgtk4.0
否则 pyo 每次都会对丢失的 wxWidgets 发出警告。但是,我认为它不会使运行失败。
sudo apt install python3-pyo
安装 pyo 1.0.0,以及它需要工作的所有二进制依赖项,依赖项由:
apt-cache depends python3-pyo
是:
python3-pyo
Depends: libc6
|Depends: libjack-jackd2-0
Depends: <libjack-0.125>
libjack-jackd2-0
libjack0
Depends: liblo7
Depends: libportaudio2
Depends: libportmidi0
Depends: libsndfile1
Depends: python3
Depends: python3
Depends: <python3:any>
python3:i386
python3
Recommends: python3-tk
Recommends: jackd2
现在,如果我尝试使用以下命令升级 pyo:
python -m pip instal --user pyo==1.0.X
优先于发行版提供的 1.0.0,我得到以下结果:
ALSA lib conf.c:3558:(snd_config_hooks_call) Cannot open shared library libasound_module_conf_pulse.so (/usr/lib/alsa-lib/libasound_module_conf_pulse.so: libasound_module_conf_pulse.so: cannot open shared object file: No such file or directory)
但后来我locate libasound_module_conf_pulse.so
在我的系统上,并解决:sudo ln -s /usr/lib/x86_64-linux-gnu/alsa-lib /usr/lib/alsa-lib
然后它就起作用了。from pyo import *
print("Default input device: %i" % pa_get_default_input())
print("Default output device: %i" % pa_get_default_output())
print("Audio host APIS:")
pa_list_host_apis()
pa_list_devices()
然后尝试使用以下命令选择特定设备:
s = Server()
s.setOutputDevice(0)
s.boot()
但是我不需要在安装
python3-pyo
后让它工作。 .
关于python - Pyo server.boot() 在 Ubuntu 14.04 上因 pyolib._core.PyoServerStateException 而失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32445375/
我在没有 jack 的 Ubuntu 14.04 上安装 pyo 并运行 Python 2.7。我遵循 Debian-based installing instructions写在 pyo wiki
我是一名优秀的程序员,十分优秀!