Welcome, guest | Sign In | My Account | Store | Cart

This is how you can play an ogg sound file in python using the pygame library. This is part of an article about Morse Code and Dictionaries in Python

Python, 6 lines
1
2
3
4
5
6
import pygame

pygame.init()
pygame.mixer.music.load("sound_file.ogg")
pygame.mixer.music.play()
pygame.event.wait()