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

[pygame] Strange mixer problem



I am running this on Ubuntu Natty, and I've had this problem on a separate

occasion on a different Natty machine. Basically, in some circumstances, I

can't play a sound with the following code:



import pygame.mixer



pygame.mixer.init()

pygame.mixer.Sound("1up.wav").play()



There will either be a click, or more often, no sound at all. There are no

error messages. I have tried using pygame.mixer.get_init() to check if the

mixer has been properly initialized (which it seems to have been). I've

tried using pygame.mixer.pre_init() to specify certain settings (my sound

files are 22050Hz and 1 channel). This didn't help, either.



The strangest and most confusing thing is that it will run just fine in

the Python interactive shell. If I load the Python shell and copy and paste

this exact code into it, I get the expected sound.



I can't for the life of me figure out what the difference would be between

the command line and the interactive shell (I've double checked the version

of the shell and the version I'm using from the command line, they are the

same).



I'm probably missing something very simple, but I've been pulling my hair

out with this and am not sure how to proceed. :)



Please let me know if I should send the sound file in question.