[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Sound files played too slowly



Tomasz Primke wrote:

I'm trying to play an ogg file in the following way:

-------------------------------------------------
pygame.mixer.music.load( 'myoggfile.ogg' )
pygame.mixer.music.play()
-------------------------------------------------

And it works, but there's a problem. If the file is too big, it is played noticably slower (it's like playing a video in the "slow" mode). The only workaround I found was split big file into smaller ones, that are played correctly.

The problem is not caused by the ogg format. I have experienced the same problem with mp3 and wav files.

(Just don't ask me, how big can the file be - I just know, that I'm not able to play my 4MB file, 3:50 long, while I can play my 2.2MB files.)

The question is: is it possible to play such a "big" files correctly using Pygame?


You must set the mixer sampling rate to be the same as the music file's sample rate. I'm guessing that the program you're using to split the file is actually resampling it as well. See the documentation for pygame.mixer.pre_init.

Alex.