belangeo / pyo

Python DSP module
GNU Lesser General Public License v3.0
1.28k stars 130 forks source link

No audio output - Ubuntu 20.04 #226

Closed X1las closed 1 year ago

X1las commented 2 years ago

Hello! I installed PYO a few days ago, and after getting the dependencies in order and troubleshooting, i'm at a loss, as i have no clue why it doesn't output sound.

I'm trying to use this basic example:

from pyo import *
import time
s = Server(duplex=0).boot()
a = Sine(440, 0, 0.1).out()
s.start()
time.sleep(1)
s.stop()
print("finished")

output:

ALSA lib pcm_dsnoop.c:641:(snd_pcm_dsnoop_open) unable to open slave
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
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
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
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
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_oss.c:377:(_snd_pcm_oss_open) Unknown field port
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_usb_stream.c:486:(_snd_pcm_usb_stream_open) Invalid type for card
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
finished

Using duplex=0 because i had trouble previously booting the server and another issue mentioned doing this to fix the issue, i couldn't find much help elsewhere :s

belangeo commented 2 years ago

Can you try it in a live interpreter (to remove all the time.sleep dance):

>>> from pyo import *
>>> s = Server(duplex=0).boot().start()
>>> a = Sine(mul=0.3).out()

If it does not work, you should investigate the audio setup to see if the default device is the good one:

from pyo import *
pa_list_devices()
print(pa_get_default_output())
lucasbracher commented 2 years ago

I can confirm same issue happened to me, pyo 1.0.4, Ubuntu 20.04.3 LTS, but with portaudio instead of jackd. I just closed Firefox and it worked after some cracks and pops.

belangeo commented 1 year ago

Audio driver already used by another process, nothing to do on the pyo side (I highly recommend using jack on linux).