#MonthOfCode day 13 - sound
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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