I use Ubuntu 10.4 and learn PyGame following the instructions "Drop the chimpanzee and win $$$".
I made two .wav files, but when I try to play them, I get a strange noise, like a knock, very short.
I am not getting an error message. Why is this not working as expected?
>>> import pygame
>>> pygame.init()
(6, 0)
>>> def load_sound(name):
class NoneSound(object):
def play(self): pass
if not pygame.mixer:
return NoneSound()
fullname = os.path.join('data', name)
try:
sound = pygame.mixer.Sound(fullname)
except pygame.error, message:
print 'Cannot load sound:', name
raise SystemExit, message
return sound
>>> whiff_sound = load_sound('whiff.wav')
>>> whiff_sound.play()
<Channel object at 0xb772f1c0>
>>>
source
share