Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

positioning sound with pygame?

Is there a way to do panning or 3d sound in Pygame? The only way I've found to control sound playback is to set the volume for both the left and right channels.

like image 665
Jared Avatar asked Nov 28 '25 20:11

Jared


2 Answers

You are correct - Pygame itself doesn't have any high-level way to position sound other than manually adjusting channel volumes (and it looks like it only supports stereo).

The best way, to do 3D-audio, especially for games, is to use OpenAL. Unfortunately, there's no way to this in Pygame (note that there is an OpenAL library in "pgreloaded," the next version of Pygame). Pyglet, however, does use OpenAL. I've never tried mixing Pygame and pyglet, though - I wonder if it would work?

like image 199
Daniel G Avatar answered Nov 30 '25 12:11

Daniel G


http://pysonic.sourceforge.net/

Try this out, it's a wrapper over the FMOD sound library, it won't disappoint :)

like image 35
Tanner Avatar answered Nov 30 '25 12:11

Tanner



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!