我正在使用 Python Wave 库生成波形,并使用自定义文件编写器将它们存储在内存中。但是,每当我尝试使用 Pygame 播放它们时,播放速度都非常慢。如果我将完全相同的对象保存到一个文件中,然后播放它,pygame 会以正常速度播放它。
(某人缩写)代码:
pygame.init()
pygame.mixer.init(size=8, buffer=2048, frequency=44100) #Thats the correct freq, but it does the same regardless
x = pygame.mixer.Sound(obj) #Load the output of the wave writer
x.play()
有任何想法吗?