快速提问。
我在 linux 下运行 pygame 只是为了播放一些音频文件。我有一些 .wav 文件,但以正确的速度播放它们时遇到问题。
import pygame.mixer, sys, time
#plays too fast
pygame.mixer.init(44100)
pygame.mixer.music.load(sys.argv[1])
pygame.mixer.music.play()
time.sleep(5)
pygame.mixer.quit()
#plays too slow
pygame.mixer.init(22100)
pygame.mixer.music.load(sys.argv[1])
pygame.mixer.music.play()
time.sleep(5)
pygame.mixer.quit()
我已经用 ggogle 代码搜索了一些东西,但似乎每个人都可以使用默认参数调用 init 函数。其他人可以尝试运行此脚本并查看他们是否获得相同的行为吗?有人知道如何加快速度吗?或者调整每个文件的速度?
谢谢。