Created
March 13, 2019 02:44
-
-
Save mludvig/b9f20fdee401b6399b17fdd3955693d4 to your computer and use it in GitHub Desktop.
Simple pygame audio test
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
#!/usr/bin/env python3 | |
# audio_test.py - simple pygame audio test | |
# Author Michael Ludvig | |
import pygame | |
# PyGame initialisation | |
pygame.init() | |
pygame.mixer.init() | |
# Audio file from Scratch | |
audio = '/usr/share/scratch/Media/Sounds/Human/Laugh-male1.wav' | |
# Play the audio and wait for completion | |
pygame.mixer.music.load(audio) | |
pygame.mixer.music.play() | |
while pygame.mixer.music.get_busy(): | |
pygame.time.Clock().tick(10) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment