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

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



Hi,
   Try pygame.mixer.init() after initializing pygame.
   Oggs work fine for me, haven't tried mp3, but in the pygame documentation describing pygame.mixer.music.play, it seems to suggest you can use OGG, MP3 and MOD formats.

-david.


On 8/26/05, Daniel Lindsley <cowz@xxxxxxxxxxxxx> wrote:
Oddly enough, this time, an .ogg file did work. Not sure why the
prior one I tried didn't work but...Thank you for the assistance.

Daniel


On Aug 26, 2005, at 10:43 PM, Rene Dudfield wrote:

> Have you tried .ogg files?
>
> On 8/27/05, Daniel Lindsley <cowz@xxxxxxxxxxxxx> wrote:
>
>> 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
>>
>




--
David Tweet
__________________
http://davidtweet.com