Rohit Jose
Rohit Jose

Reputation: 209

Audio isn't loading

I have used pygame a lot, but never used sound before. I have checked and the files are there by the right name, and I have used the right pathway, but I just get this error message:

Traceback (most recent call last):
File "C:\Users\Rajive\AppData\Local\Programs\Python\Python3.4.3\D C W.py", line 11, in module door_opening = pygame.mixer.Sound('C:\Users\Rajive\Downloads\door_opening.m4a')
pygame.error: Unable to open file 'C:\Users\Rajive\Downloads\door_opening.m4a'

import random, time, pygame
time = time.clock()
pygame.init()
diff = 1
door_opening =  pygame.mixer.Sound('C:\\Users\\Rajive\\Downloads\\door_opening.m4a')
door_closing =  pygame.mixer.Sound('C:\\Users\\Rajive\\Downloads\\door_closing.m4a')
closet_opening =  pygame.mixer.Sound('C:\\Users\\Rajive\\Downloads\\closet_opening.m4a')
closet_opening =  pygame.mixer.Sound('C:\\Users\\Rajive\\Downloads\\closet_closing.m4a')
window_opening =  pygame.mixer.Sound('C:\\Users\\Rajive\\Downloads\\window_opening.m4a')
window_opening =  pygame.mixer.Sound('C:\\Users\\Rajive\\Downloads\\window_closing.m4a')

Upvotes: 0

Views: 103

Answers (1)

nabulator
nabulator

Reputation: 278

From pygame documentation:

The Sound can be loaded from an OGG audio file or from an uncompressed WAV.

Doesn't look like the .m4a codec is supported. Perhaps try converting your file first.

Upvotes: 1

Related Questions