So I downloaded the files, and I did get a wave file to play using the pymedia modules. It was really quite easy, but it makes blender freeze until its done playing the wave. Is there something I need to do in blender (my python script) to help this or is it just the pymedia module?
It must be just sitting on the pulse waiting for the script to finish. You need something like a start command that doesn’t wait for the wav to finish, rather than a play type command. That’s just my guess, of course.
Hmm. just looked at the tutorial for pymedia. As long as you didn’t use the line
while snd.isPlaying(): time.sleep( 0.05 )
It shouln’t hold up the game so it would be something else.
Thanks for the help fireside. I thought you might be the one to answer. I wasnt using that loop and I think it was just the pymedia. I used the mixer module from pygame instead. If anyone is curious about doing this heres the run down:
All you need are 2 files from the pygame installtion in your runtime dir:
(Note: I believe this setup is for windows only.)
Then use this simple code:
import mixer mixer.init() mysound=mixer.Sound('c:\money.ogg') #Your filename mysound.play(0,0)
It can play various file formats, but being able to ogg files is great!
There is a whole run down on using this module at:
Anyways might be fun!
Currently I am working on a script that will create a 3d sound just by using panning, volume, and distance calculations. No doppler effect for now.
Perhaps someone could come up with the linux file requirements?
Yeah I have played with it before, but never got the PyMedia working because of some stupid errors I got while trying to install it. I’m not sure, but I thought PyMedia is also able to playback video files, or not?
Yeah. Pymedia can do videos too. The pygame module is great! Ive been playing with channels and panning and what not. Looks very promising. I have a jump sound with my character that works every time. No slips or skips. Along with the background music. You can edit and control seperate channels and can even setup a quere so that if you wanted, you could have smooth flowing music that would change as certain actions were taking place. I have a looping background music ogg file and it loops perfectly. Cant even tell there is a seam in the sound.
I will post when I perfect it a bit.
BTW: HELLO TO JDMULTI!! Havent heard from you guys in a while.
I think pygame is the best solution also. It’s the most common on systems. In linux I have to use an export statement of the path before using it, but other than that, it runs great. Most people on Linux that play games have pygame installed. If they don’t, the installation only takes a few minutes.
The thing I don’t quite understand is why when I import sys and print sys.path from Blender, it knows where everything is, but it says it can’t find it when I import unless I use the export statement before running Blender. I can’t figure that out. It sounds like Windows has path problems also that need to be straightened out. Hopefully they will do that someday so we can just import externals without all this bother.
Yeah path issues are a definate pain, both in blender as well as python. I have been using pygame in blender for a while and it’s a great way to go. It still has better joystick support than blender which I am using. (Well, to be fair I used it for joystick before the joystick actuator was added, and I haven’t tested the actuator that much so…)
Good way to handle sounds because sounds in blender are iffy. The only downside is you lose the 3d capabilities blender’s sound system has, but it’s the best way to go at this point: it will run on all systems and it doesn’t act wierd
The nice thing about paths is that if you release your game you can just include everything (all the python externals and the game’s runtime) in one directory and not worry about paths at all
How do I get pymedia to work in Blender?
I’m using 2.42a. Python 2.43 and the latest pymeda. I’ve tried “import pymedia” but it cant find te module.
What am I missing?