Simple background sound effect playback

catalinfest at gmail.com catalinfest at gmail.com
Sat Dec 20 05:02:40 EST 2014


See this :

>>> pygame.mixer.init(frequency=22050, size=-16, channels=2, buffer=4096)
>>> song = pygame.mixer.Sound("bird.ogg")
>>> pygame.mixer.Sound.play(song)
and then use the 
>>> channel.set_volume(0, 1)
>>> time.sleep(1)


On Wednesday, December 17, 2014 10:02:30 PM UTC+2, Jacob Kruger wrote:
> 
> 
> Ok, trying simple code from a pygame tutorial 
> snippet - nothing happens - just silent, but with no errors being 
> returned:
> # import the pygame module
> import  pygame
> # start pygame
> pygame.init()
> # load a sound file into memory
> sound = pygame.mixer.Sound("bird.ogg")
> channel = sound.play()



More information about the Python-list mailing list