#MonthOfCode day 13 - sound
import pygame | |
from time import sleep | |
#replace this by some cool sound effect & music ! | |
SFX = 'alrighty.wav' | |
MUSIC = '4sequence.mp3' | |
# init pygame ; load n play a sound effect | |
pygame.init() | |
soundObj = pygame.mixer.Sound('alrighty.wav') | |
soundObj.play() | |
# load n play some background music | |
pygame.mixer.music.load('4sequence.mp3') | |
pygame.mixer.music.play(-1, 0.0) | |
# replace the sleep by whatever your game needs to do | |
sleep(16) | |
# stopping sound before exit | |
pygame.mixer.music.stop() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment