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

[pygame] Problem loading 48 sounds?



Hi!
I've created a simple 2D graphic program to play the piano thanks to a computer keyboard: see https://github.com/gustavklopp/pypiano
(you can clone it, it's only 2 files and the sound ressource)

Even if setting the FPS to 40, I can't even get that with my not so weak laptop (AMD A4-5000 1.5 GHz, AMD Radeon HD 8330, RAM 4096MB), and I'm stuck to just 30FPS. Sometimes, if I play a  little longer than a few minutes, the program even crash (no more sound and I can't exit without Ctrl+Alt+Sup).
For a music program, at 30FPS, you can detect the delay between the typing and the playing of the sound...

I think the problem is with loading my 48 OGG sounds (48-key keyboard) at the beginning: I'm using:
`pygame.mixer.pre_init(44100, -16, 2, 4096)`

Is there some solutions to have this program not crashing when trying to play the sounds and improve the FPS?
Maybe if you try it on your computer, the FPS are better and it's a problem with my OpenGL and Radeon Driver (known to be quite touchy)?

Thanks a lot for your help!