Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import pygame.mixer
- import os
- from pygame.mixer import Sound
- pygame.mixer.quit() #Sound does not play without this line
- pygame.mixer.init()
- try:
- hello = Sound(os.path.join("music","Hello.ogg"))
- while True:
- hello.play()
- except:
- raise UserWarning, "could not load sound file"
- #!/usr/bin/env python
- import pygame.mixer
- import os
- from pygame.mixer import Sound
- pygame.mixer.quit() #Sound does not play without this line
- pygame.mixer.init()
- try:
- hello = Sound(os.path.join("music","Hello.ogg"))
- hello.play(0)
- except:
- raise UserWarning, "could not load sound file"
- #!/usr/bin/env python
- import pygame.mixer
- import os
- from pygame.mixer import Sound
- pygame.mixer.quit() #Sound does not play without this line
- pygame.mixer.init()
- try:
- hello = Sound(os.path.join("music","Hello.ogg"))
- i = 0
- while (i < 3):
- hello.play()
- i = i + 1
- except:
- raise UserWarning, "could not load sound file"
- time.sleep(hello.get_length())
- #!/usr/bin/python
- import time
- import pygame
- import os
- pygame_init()
- sound = pygame.mixer.Sound(os.path.join('music','Hello.ogg'))
- sound.play()
- time.sleep(sound.get_length())
- # other initialization on top
- mpg123 -q /home/pi/coolsong.mp3 &
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement