我正在尝试使用内置的winsound库在彼此之上叠加多个声音。我从第一声开始

winsound.PlaySound("test1.wav", winsound.SND_FILENAME | winsound.SND_ASYNC)

当我尝试开始其他声音时
winsound.PlaySound("test1.wav", winsound.SND_FILENAME | winsound.SND_ASYNC
            | winsound.SND_NOSTOP)

我得到的不是很描述RuntimeError: Can't play sound
我该如何解决?

最佳答案

我可以使用winsound和playsound播放两种声音:

from playsound import playsound
import winsound
#
filename1 = "C:/Users/sound1.wav"
filename2 = "C:/Users/sound2.wav"
soundfile = filename1
winsound.PlaySound(soundfile, winsound.SND_FILENAME|winsound.SND_ASYNC)
playsound(filename2)

关于python - 如何使用Winsound同时播放多个声音?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/33574945/

10-10 10:18