MP3's in GE - Pygame?

Everyone knows about WAVs and MP3’s/OGG’s. In comparison, take a song that’s relatively 3 minutes long in mp3 (or ogg) format, it’s about 3mb. But in wav format it is 37mb. Now you would understand that no game designer wants to distribute their games for download while the games file size is over 100mb from sounds alone, right? WAV format is the only sound file that Blender (2.49b) understands at the time being. Hopefully Blender 2.5 will have mp3 and ogg support (correct me if I’m wrong!) But until then I’ve got a few games ranging from 42mb to 100mb… as .blend files, not the zipped folders with the exe and dll’s.

I have heard of “pygame” and I was probably using an outdated version of it also, it gave me a lot of errors and didn’t work.

I have seen ST150’s pygame sound/music tutorial (http://www.blending-online.co.uk/8501/37901.html) which was obviously outdated or his instructions failed. I tried this and the only result I got was several error messages in the console window. I also looked at “Mmph!”'s tutorial but that also seemed outdated, as I am currently using Python 2.6 with Blender 2.49b (on Windows Vista).

I installed pygame for python 2.6, but I see Blender users packing up these pygame files with mp3 games. I don’t know where to find these specific files for the .exe versions of my games and I don’t know the proper python code to import the pygame to play the mp3 files. I need some help here this is confusing! :eek:

[edit] I used the pygame from ST150’s tutorial (link above), took the python 2.3 file out and used the following code to play the music:

import pygame.mixer
import os
pygame.mixer.init()
pygame.mixer.music.load("music.ogg")
pygame.mixer.music.play()

Once I put the py and pyc files along with the pygame folder into the main folder with the dll’s and exe, I got the game running but received the following error in the console window when I pressed space bar to activate the python code (using logic in blender).

Error in console window:

Python script error from controller “cont#CONTR#1”:
Traceback (most recent call last):
File “music”, line 1, in <module>
File “C:\Users\Ryuzaki\Desktop\0test\pygame_init_.py”, line 64, in <module>
from pygame.base import *
ImportError: DLL load failed: the specified module could not be found.

I’m still not sure what to do here or what files to stick with [end edit]

Hello
in graphicall.org there’s a Blender version with OGG and mp3 support…maybe included in Blender 2.5?
Bye

The BGE in 2.5 will indeed have ogg and mp3 support (I’ve tested it. :smiley: ). The error you’re getting is because you’re missing some dlls. Aside from the *.py, *.pyo, and *.pyd files, did you also copy all of the dlls? I’ve gotten PyGame working before, and I think Mmph!'s thread should still be valid.

OTO wrote:

Hello
in graphicall.org there’s a Blender version with OGG and mp3 support…maybe included in Blender 2.5?
Bye
Thanks for the reference to graphicall.org! I’ll check the Blender file there.

Moguri wrote:

The BGE in 2.5 will indeed have ogg and mp3 support (I’ve tested it. :D). The error you’re getting is because you’re missing some dlls. Aside from the *.py, *.pyo, and *.pyd files, did you also copy all of the dlls? I’ve gotten PyGame working before, and I think Mmph!'s thread should still be valid.
I checked Mmph!'s thread, the download site is in construction and is postponed until September 18th, but I checked it a week ago and it showed it would be done Sep. 9th. They may keep pushing the date back. Also that’s great news that Blender 2.5 will have mp3 support! I’ll wait for October for 2.5, that will make things much easier for distributing the games as simple .exes.

Thanks for the info! :smiley:

Please see this link :


You use pygame module and let blender to working more easy.
You see the answer.