Pygame music play start position seems to have a 1 second resolution

56 Views Asked by At

I'm using pygame.mixer.music.play to load and play a wav file as follows:

from pygame import mixer
mixer.init()
wavfile = "/my/wav/file.wav"
mixer.music.load(wavfile)
start = 0.5
mixer.music.play(start=start)

However, start seems to have a 1 second resolution. In other words, any float acts as if it was truncated to its whole number part. This is unexpected because the documentation of pygame shows that the start position is a float given in seconds. In fact, investigating the source, you can see that mixer.music.play is just a thin wrapper around the SDL library's Mix_FadeInMusicPos (documented here). Those docs also show a float second start time.

Is this a limitation of the wav format, the library, or am I specifying something incorrectly here?

0

There are 0 best solutions below