pySonic is a Python wrapper around the high performance, cross platform FMOD sound library. You get all the benefits of the FMOD library, but in a Pythonic, object oriented package.
Binaries for the current version of pySonic are available for download on our pySonic SourceForge project page.
To build your own binary, you can check out the code in our SourceForge CVS repository, compile it yourself, and link it against the static FMOD lib files included in the FMOD distribution. A distutils setup script makes all this as easy as typing something like:
python setup.py build_ext -i -cmingw32
pySonic is an open source Python package covered by the MIT license. No catch there. On the other hand, the FMOD library itself is a closed source product with various licensing schemes. But not all hope is lost. If you plan to use FMOD in a product that is not intended to make money and does not make you any money, then you may use FMOD free of charge. See the FMOD website for details.
The best way to start learning how to use pySonic is to read a short tutorial. After that, you can use the API documentation as a reference.
The following example will give you a taste of using pySonic.
import pySonic import time def finished_stream(source): print 'Stream finished playing' # initialize the audio environment w = pySonic.World() # create two sources src1 = pySonic.Source() src2 = pySonic.Source() # load a sound entirely from disk, stream another from disk src1.Sound = pySonic.FileSample('short.wav') src2.Sound = pySonic.FileStream('long.mp3') # position the sources in 3D space src1.Position = (-0.5, 0.0, 0.5) src2.Position = (0.5, 0.0, 0.5) # register a callback for when the stream finishes src2.SetEndStreamCallback(finished_stream) # register a callback for when the stream finishes src1.Play() src2.Play() # just block while we're playing in this example while src1.IsPlaying() or src2.IsPlaying(): time.sleep(1)
pySonic is written almost entirely in Pyrex. A few raw C functions help support the FMOD callbacks and memory streams. A suite of unit tests cover most of the functions in the package. Check the source code out of our SourceForge CVS repository for more details.
There isn't a one-to-one mapping between FMOD functions and pySonic functions. Many of the FMOD C functions just aren't needed or don't fit in a object oriented Python library. But, roughly speaking, pySonic can be said to support the following FMOD features.
pySonic currently does not support the following FMOD features. Look for them in future versions.
If you would like to request a new pySonic feature, use our SourceForge feature tracker. If you would like to contribute code to pySonic, email me.
Of course! View our SourceForge bug tracker for a list of known bugs. Please submit bug reports using the tracker.
pySonic is covered under the MIT License. pySonic is Copyright © 2004 Peter Parente. See the license linked here or included with the binary download for more details.