First of all, the file that I want to play is not the reason for the error; this looks like a problem with ALSA. As you can see, even when I want to start the sound file directly in the terminal (auto-complete) I am getting an error.
If I start my Python program as root (I have to start it as root cause the keyboard-module) this problem occurred:
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
Stopping program
Stopping program
Traceback (most recent call last):
File "[...]/run.py", line 26, in <module>
main()
File "[...]/run.py", line 11, in main
GameStateManager.change_gamestate(SetupState())
File "[...]/src/game_state.py", line 103, in __init__
self.setup_sound_manager()
File "[...]/src/game_state.py", line 110, in setup_sound_manager
GameState.sound_manager = SoundManager()
File "[...]/src/utils.py", line 253, in __init__
mixer.init()
pygame.error: ALSA: Couldn't open audio device: No such file or directory
If I run a a sound manually with sudo aplay test.wav
than this error comes up:
ALSA lib pcm_dmix.c:1032:(snd_pcm_dmix_open) unable to open slave
System
/-
ooo: ----------------------------
yoooo/ OS: ArcoLinux
yooooooo Kernel: 5.17.4-arch1-1
yooooooooo Uptime: 3 days, 23 hours, 2 mins
yooooooooooo Packages: 1373 (pacman)
.yooooooooooooo Shell: zsh 5.8.1
.oooooooooooooooo Resolution: 1920x1080
.oooooooarcoooooooo WM: i3
.ooooooooo-oooooooooo Theme: Arc-Dark [GTK2/3]
.ooooooooo- oooooooooo Icons: Sardi-Arc [GTK2/3]
:ooooooooo. :ooooooooo Terminal: alacritty
:ooooooooo. :ooooooooo CPU: AMD Ryzen 5 2500U with Radeon Vega Mobile Gfx (8) @ 2.000GHz
:oooarcooo .oooarcooo GPU: AMD ATI Radeon Vega Series / Radeon Vega Mobile Series
:ooooooooy .ooooooooo Memory: 2015MiB / 6904MiB (29%)
:ooooooooo /ooooooooooooooooooo
:ooooooooo .-ooooooooooooooooo.
ooooooooo- -ooooooooooooo.
ooooooooo- .-oooooooooo.
ooooooooo. -ooooooooo
This question is totally unrelated to my problem, which is with the audio component specifically being unable to open the driver. Linked question is about a resource not loading.