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

Re: [pygame] pygame hangs with some mp3 files and hangs the hole prozess



Hi!

    The file may be breaking up if the buffer size is low or the sound frequencies wrong. Try the init before you do the mixer init so that the problem is narrowed down. I am giving you the site to read it all. But the music mixer only plays one sound at a time. MP3 may have an issue with buffer size and play time...
http://www.pygame.org/docs/ref/mixer.html
 also has a special streaming channel. This is for music playback and is
accessed through the
pygame.mixer.music
 module.
The mixer module must be initialized like other pygame modules, but it has some extra
conditions. The
pygame.mixer.init
 - initialize the mixer module
 function takes several optional arguments to control the playback rate and sample
size. Pygame will default to reasonable values, but pygame cannot perform Sound resampling,
so the mixer should be initialized to match the values of your audio resources.
NOTE:
 there is currently a bug on some windows machines which makes sound play back 'scratchy'.
There is not enough cpu in the sound thread to feed the buffer to the sound api.
To get around this you can increase the buffer size. However this means that there
is more of a delay between the time you ask to play the sound and when it gets played.
Try calling this before the
pygame.init or pygame.mixer.init calls.
pygame.mixer.pre_init(44100,-16,2, 1024 * 3)
        Bruce


Stefan wrote:
pygame.mixer.music.load('test.mp3') but the result are the what i
said: 1 time sound is gone second time (any other file) and it hangs.