Using PySonic/FMOD for Linux music support (help needed from Linux users)

I decided to play around with PySonic and FMOD when the tutorial was posted a few days ago. It works great in Windows, but I really want multi-platform support. From reading the Sourceforge page on PySonic, it should support Windows, Linux and Mac, and versions of FMOD are available for each OS as well.

I downloaded the Linux FMOD .so file and packaged it with my level for Social’s Freezline game to see if it works, only problem is I don’t have a Linux box. If some Linux users could test it out and find and fix errors for me, it would be most apprecaited.

Here’s the .zip file: Freezeline - Blendenzo

A Linux tutorial will follow once I know how to make it work.

Hmm. Short answer no, for me anyway. First of all, I think pyd is a windows thing. I don’t know anything about it, I just know it didn’t recognize it. The other problem is somehow you have to include the directory in the python path. Unfortunately, it’s not there by default. Kind of a cruddy deal.

Check out this page:
http://www.pyzine.com/Issue001/Section_Articles/article_EPwCPartI.html

Notice here:

To execute import tiny, Python finds the tiny extension module (normally called tiny.pyd on Windows, tiny.so on Linux) in some directory along the sys.path, loads the module into memory, and finds and calls a function named inittiny in the module.
So apparently it has to be named .so in linux? The best thing to do if you want to pursue it, is to make it so it can be tested outside of blender by calling pySonic and a music file.

It just keeps getting better by the way. For instance, I tried using pygame in this way and linux couldnt find the sound driver because it was in use. I think there was a conflict with using sdl.so twice, which there might not be here since it’s using fmod, so I think there is a possibility this may work for me. There is the other possibility, though, that it can’t use two sound programs at the same time, at least on my system.

Yea, I was testing this for some time now, but no luck. I tried it with .pyd and .so extensions, but for some reason I just keep getting the same import error.

It just can’t seem to find PySonic.

I’ll try to do some more research on the topic, but it doesn’t look like the BGE is all that “linux geared” (at least not as much as it is windows geared), which is actually kind of strange considering that it’s all under the Open Source flag.

Anyway, I would really like to see this working on linux (really tired of booting windows only for blender)

Thanks for your efforts on this fireside.

Yeah, I checked out pysonic and it’s windows only. The new Microsoft open source. Blender is starting to go the same way.

fireside, thanks for the info. I’m pretty sure that Blender looks first in the directory of the game for extra Python files. We’ll find that out eventually, though. It is very helpful to know that compiled Python extensions are not the same in Windows and Linux. I can point you to the source code if either of you are interested in compiling a pySonic.so file.

Edit: Sorry. wrong link. Just a minute

I’m reading the source code for PySonic right now, and it definitely provides support for the Linux machines. Only a Windows version is available, but that doesn’t mean you can’t compile it to work with Linux. I’m not sure yet exactly which files you’ll need. I’ll update you when I get all the info together.

Edit:

if os.name == 'nt':
  fmod_home = 'fmodapi374win/api'
  libs = ['fmodvc']
  include_dirs = [fmod_home+'/inc']
  library_dirs = [fmod_home+'/lib']
  objects = []
elif os.name == 'posix':
  fmod_home = 'fmod/'
  libs = ['fmod']
  include_dirs = [fmod_home+'api/inc']
  library_dirs = [fmod_home+'api']
  objects = []
else:
  raise RuntimeError, 'You need to modify setup.py to work with %s' % os.name

Where “nt” is windows and “posix” is any Unix based system, including Linux.

Okay, if you’re still interested, it seems to me that you need to take the files from this directory and compile them using Pyrex. I have read several reports of successful builds on Linux systems, though I have also read it is very difficult to compile PySonic on Macs.

Thanks for the info Blendenzo. I don’t know if I’ll monkey with it or not. It’s usually pretty hard to get things like that going because the authors have no concern for cross platform apps. I can’t even get Blender to compile on Ubuntu, or rather a working version. They must be using a library version that isn’t posted yet in the Repositories or something because I know I have all the dependencies. Anyway, it’s kind of a choice between writing a game and doing those things and I’d rather write a game. Music is pretty secondary to me. I can get sound effects and animation going pretty well and that’s what I’m focused on. I’d be much more interested in getting sdl mixer working with the Blender source code if I did something like that. Blender is turning into the same thing. They provide a solution and all dependencies for Windows users and then throw every one else a bone. Not that it’s all Microsoft, Linux does defaults horribly, but the Microsoft way is setting in to the open source movement.