Trying to play .wav files using python3-pyaudio does not work. An upgrade to version >= 0.2.12 makes it work. Reproducible: Always Steps to Reproduce: Script to reproduce attached. Actual Results: $ python3 pyaudio-test.py ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.front.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM front ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround40.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround40 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround41 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround50 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround51 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround71.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround71 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM iec958 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline Traceback (most recent call last): File "/local/mfabian/src/ibus-typing-booster/engine/pyaudio-test.py", line 27, in <module> stream.write(data) File "/usr/lib64/python3.11/site-packages/pyaudio.py", line 585, in write pa.write_stream(self._stream, frames, num_frames, SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats Expected Results: Should play a sound. The test .wav file used in the script is in the package ibus-typing-booster: $ rpm -qf /usr/share/ibus-typing-booster/data/coin9.wav ibus-typing-booster-2.23.4-1.fc38.noarch
Created attachment 1987820 [details] Test file to reproduce the problem Test like this: - make sure ibus-typing-booster is installed to have the test .wav file used in the script available - Run the script like this: `python3 pyaudio-test.py`
Thank you very much for the bug report and the PRs. I'll use the opportunity to include some additional changes (update spec to latest Python packaging guidelines, migrate to SPDX license).
(In reply to Christian Krause from comment #2) > Thank you very much for the bug report and the PRs. I'll use the opportunity > to include some additional changes (update spec to latest Python packaging > guidelines, migrate to SPDX license). Great, thank you very much!
FEDORA-2023-4025f362c0 has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2023-4025f362c0
FEDORA-2023-f675d09ee6 has been submitted as an update to Fedora 38. https://bodhi.fedoraproject.org/updates/FEDORA-2023-f675d09ee6
FEDORA-2023-bb295d0bd4 has been submitted as an update to Fedora 37. https://bodhi.fedoraproject.org/updates/FEDORA-2023-bb295d0bd4
Created attachment 1988209 [details] pyaudio-test-trigger-hang.py With the updated python3-pyaudio, it works but not reliably. It sometimes hangs, pretty often actually. The attached script makes it rather easy to reproduce the hang. It should do 99 beeps, but does the full amount of beeps not always, quite often it hangs like this: $ python3 ~/tmp/audio-test/pyaudio-test-trigger-hang.py ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.front.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM front ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround21 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround40.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround40 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround41 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround50 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround51.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround51 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.surround71.0:CARD=0' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM surround71 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM iec958 ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib confmisc.c:1369:(snd_func_refer) Unable to find definition 'cards.0.pcm.iec958.0:CARD=0,AES0=4,AES1=130,AES2=0,AES3=2' ALSA lib conf.c:5181:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5704:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM spdif ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm.c:2666:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave and here at this `ALSA lib pcm_dmix.c:999:(snd_pcm_dmix_open) unable to open slave` message it hangs, there is no more sound and the script never finishes. I can stop it here with Control-C only because I added: # Make Control-C work when it hangs: signal.signal(signal.SIGINT, signal.SIG_DFL) to the script. When it hangs, stopping the script with Control-C and starting it again, usually reproduces the hang immediately. Using aplay /usr/share/ibus-typing-booster/data/coin9.wav in a different terminal while this test script is hanging does not work, aplay then hangs as well. But after stopping the test script with Control-C, running aplay /usr/share/ibus-typing-booster/data/coin9.wav once seems to "fix" the problem, aplay produces the correct sound and the next run of the test script usually works as well.
I should probably make a new bug report for this hang. I can quite easily reproduce the hang using your latest build on Fedora 38: https://koji.fedoraproject.org/koji/buildinfo?buildID=2287903
FEDORA-2023-4025f362c0 has been pushed to the Fedora 39 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-4025f362c0` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-4025f362c0 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-f675d09ee6 has been pushed to the Fedora 38 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-f675d09ee6` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-f675d09ee6 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
FEDORA-2023-bb295d0bd4 has been pushed to the Fedora 37 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2023-bb295d0bd4` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2023-bb295d0bd4 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
(In reply to Mike FABIAN from comment #8) > I should probably make a new bug report for this hang. I can reproduce similar issues (see below). Anyway, I suggest a new bug report as well. Let's keep using this one for the update and fixing the issue that the package didn't work at all. Just to double-check: Do you see the same issues with your own local builds of pyaudio? > I can quite easily reproduce the hang using your latest build on Fedora 38: > https://koji.fedoraproject.org/koji/buildinfo?buildID=2287903 A few notes from my tests: - works worse if there are other active audio players (e.g. a browser): lots of stutter, sometimes hanging pyaudio - I tried using mpg123 with portaudio plugin (to test the underlying portaudio library): issues couldn't be reproduced
New bug for this hang: https://bugzilla.redhat.com/show_bug.cgi?id=2238746
FEDORA-2023-4025f362c0 has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2023-bb295d0bd4 has been pushed to the Fedora 37 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2023-f675d09ee6 has been pushed to the Fedora 38 stable repository. If problem still persists, please make note of it in this bug report.