Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Working with audio generates error (WSL2 - Windows11) #2857

Closed
toxfu opened this issue May 16, 2024 · 2 comments
Closed

Working with audio generates error (WSL2 - Windows11) #2857

toxfu opened this issue May 16, 2024 · 2 comments
Labels
bug Not working as intended

Comments

@toxfu
Copy link

toxfu commented May 16, 2024

only pygame-ce enviroment on WSL (Windows 11)

  • Operating system (Linux(Ubuntu) WSL2):
  • Python version (3.11.9) :
  • sdl2 2.30.2
  • sdl2_image 2.8.2
  • sdl2_mixer 2.6.3
  • sdl2_ttf 2.22.0
  • pygame-ce version (2.4.0.1):

when I want to work with audio, regardless of the code, it always generates the following error:

ALSA lib confmisc.c:855:(parse_card) cannot find card '0'
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_card_inum returned error: No such file or directory
ALSA lib confmisc.c:422:(snd_func_concat) error evaluating strings
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1342:(snd_func_refer) error evaluating nam
...
ALSA lib conf.c:5204:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5727:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2721:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
...
pygame.error: ALSA: Couldn't open audio device: No such file or directory

I have already tried the solution with PulseAudio, it works well with applications. But I can't get it to work with pygame.

postscript: I have used this tutorial https://www.linuxuprising.com/2021/03/how-to-get-sound-pulseaudio-to-work-on.html

@toxfu toxfu added the bug Not working as intended label May 16, 2024
@ankith26
Copy link
Member

It seems like pygame-ce is trying to find PulseAudio and failing, then falling back to using ALSA.

Could you try updating to pygame-ce 2.5.0.dev2 and using the PipeWire driver? To use the pipewire driver just do something like SDL_AUDIODRIVER=pipewire python3 your_app.py

@toxfu
Copy link
Author

toxfu commented May 17, 2024

As I had been working with my WSL environment for years, at the time the audio was a problem, so I did the pulseaudio tutorial.

Searching I found that WSL now comes with WSLg (which has audio control included). Installed a new WSL environment and everything works great with audio (includes pygame-ce=2.4.1).

Thanks for your time.

@toxfu toxfu closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants