When I play a sound every 0.5 second with PyGame:
import pygame, timepygame.mixer.init()
s = pygame.mixer.Sound("2.wav")for i in range(8):pygame.mixer.Channel(i).play(s)time.sleep(0.5)
it doesn't respect the timing correctly at all.
It's like there are pause of 0.2 sec than 0.7 sec then 0.2 sec again, it's very irregular.
Notes:
I know that
time.sleep()
is not the most accurate in the world, but even with the more accurate solutions from here, the problem is still presentTested on a RaspberryPi
The problem is still there if I play many different files
s[i].play()
, with i in a big range. So the problem doesn't come from the fact it tries to replay the same file