[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Mac OS X PyGame .ogg/.mp3 support?



Pygame Users,

I'm somewhat new to Pygame. I've followed some tutorials online and seem to have hit a snag. I'd like to use either a .ogg or .mp3 file to play as background music for my game. One tutorial I read said this works fine and that Pygame supports those formats. However, when running Pygame, the only type of sound file I can get to load is .wav under Mac OS X. I'm wondering if I am missing libraries or what might be the issue. A sample traceback and full (contrived) source follows.

Daniel Lindsley



Source
----------
import os, pygame

pygame.init()
size = width, height = 100, 100
screen = pygame.display.set_mode(size)

bg = pygame.Surface(screen.get_size())
bg = bg.convert()
bg.fill((255, 255, 255))

pygame.mixer.music.load("Tech.mp3")
pygame.mixer.music.play(-1, 0.0)

while True:
  screen.blit(bg, (0, 0))
  pygame.display.flip()



Traceback
---------------
Traceback (most recent call last):
  File "mp3test.py", line 11, in ?
    pygame.mixer.music.load("Tech.mp3")
pygame.error: Module format not recognized