Pyglet and Sound

Hi everyone! I've been trying to make pyglet play sound. I have installed AVbin but that has not made any difference, not even wav files make any sound when I try to play them. So I ran 'python -m pyglet.info' and this is what it told me:

...
pyglet.media
------------------------------------------------------------------------------
driver: pyglet.media.drivers.silent

pyglet.media.avbin
------------------------------------------------------------------------------
Library:
AVbin version: 6
FFmpeg revision: 13661

pyglet.media.drivers.openal
------------------------------------------------------------------------------
OpenAL not available.

I'm not an expert, but since I'm running Linux, shouldn't it say something about Alsa? Could anyone help me?

(log in to comment)

Comments

If it loaded the silent driver, then an error was encountered trying to load the ALSA driver -- probably a version mismatch or missing the user-space library. The easiest solution is probably to install OpenAL on your system (pyglet doesn't work great with ALSA, to the extent that support for ALSA has been dropped from the next version of pyglet).
I installed openal and everything is working. Thanks a lot!
For me, python -m pyglet.info shows this:
pyglet.media.avbin
------------------------------------------------------------------------------
AVbin not available.
I do have it installed...
j-1: Importing "pyglet.media.avbin" from a python shell should give you a better reason for why pyglet couldn't load AVbin. Most likely it's installed somewhere that pyglet can't find. On Linux you should make sure that /usr/local/lib is in the library path if that's where libavbin.so is.
After much tinkering, I found that there is something wrong with the library itself.

This is what the avbin-linux-x86-64-6 version says:
>>> ctypes.cdll.LoadLibrary("libavbin.so")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.5/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib64/python2.5/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libavbin.so: undefined symbol: __isoc99_sscanf
I tried compiling the svn version as well:
>>> ctypes.cdll.LoadLibrary("libavbin.so")
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python2.5/ctypes/__init__.py", line 431, in LoadLibrary
    return self._dlltype(name)
  File "/usr/lib64/python2.5/ctypes/__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libavbin.so: undefined symbol: BZ2_bzDecompressInit
The first suggests it's a glibc issue. Which version should I upgrade to?
Hmm, version 6 should have resolved this issue: http://code.google.com/p/avbin/source/detail?r=40.

I'll take a closer look later on. If you're desperate for sound, upgrading to glibc 2.7 should fix the problem.

AVbin version 7 fixes the issue for 64-bit Linux. It also fixes the problem reported earlier on Linux-32/64 when running against old glibc without support for stack_chk.
Thank you!