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

Re: [pygame] varying sound playback rate



Miriam English said:
> OpenAL has some interesting 3D capabilities -- something that will be
> very useful for me later... but after a quick scan thru the
> documentation I can't see much else. Guess I have to sit down and really
> delve into the docs.

Based on Alex's suggestion of looking at OpenAL and ctypes, I cobbled
together the following little test:

http://www.bigdicegames.com/Code/Samples/OpenALTest/openALTest.py

which loads a WAV file, and plays it back in three voice harmony with each
voice at a different pitch.

I haven't yet fully familiarized myself with the ctypes tools to generate
the function prototypes automatically, so I did it by hand for the
functions I used.

I was kind of surprised to find that loading a WAV file from disk isn't
part of OpenAL itself (check out the ALUT libraries for that, I guess), so
I used Python's built-in wave module to load my WAV files.



I know you mentioned requiring an open source library, but if all you need
is free for non-commercial use, you might also consider the BASS sound
library: http://www.un4seen.com/

It doesn't have Python bindings, so you'd have to go through the ctypes
process for it, too.


-Dave LeCompte