Reputation: 65
I am getting an error when I try and play a sound in pygame
. This is my code
import pygame
pygame.init()
pygame.mixer.music.load('easy going.mp3')
pygame.mixer.music.play(0)
And this is the error it gives me
File "c:/Users/Isaiah/Desktop/All of my programs/pygame sound.py", line 5, in pygame.mixer.music.load('easy going.mp3') pygame.error: Couldn't open 'easy going.mp3'
Upvotes: 0
Views: 530
Reputation: 65
I figured it out!
import pygame
pygame.mixer.init()
sound = pygame.mixer.Sound(r"C:\Users\Isaiah\Desktop\easy_going (online-audio-converter.com).wav")
s = pygame.mixer.Sound.play(sound)
#Delay loop
while s.get_busy():
pygame.time.delay(100)
Upvotes: 1