我尝试了所有库,现在尝试使用pygame的混音器,但是alsa驱动程序存在很多问题,例如:
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_card_driver returned error: No such
file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_concat returned error: No such file or
directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4693:(_snd_config_evaluate) function snd_func_refer returned error: No such file or
directory
ALSA lib conf.c:5181:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2642:(snd_pcm_open_noupdate) Unknown PCM default
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
pygame.error: ALSA: Couldn't open audio device: No such file or directory
所以我尝试更改默认驱动程序,就像这里所说的https://wiki.libsdl.org/FAQUsingSDL#Win32,但是现在我在每个选项中都有这个问题pygame.error: Audio target 'winmm' not available
我不知道我还能做什么,有人可以帮助我吗?我在Windows顺便说一句
最佳答案
问题是我正在使用wsl,但收到了alsa驱动程序错误。我在Windows Powershell中运行了代码,它起作用了!
关于windows - 我无法使用python播放音频,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/62984020/