pythonaudio-processing

Can't import audiolab in python


I installed audiolab from this source:

http://www.lfd.uci.edu/~gohlke/pythonlibs/#scikits.audiolab

Those are the only windows binaries for python 2.7 I was able to find.

When I call from scikits import audiolab I get the following error:

Traceback (most recent call last):
  File "<pyshell#5>", line 1, in <module>
    from scikits import audiolab
  File "C:\Python27\lib\site-packages\scikits\audiolab\__init__.py", line 34, in <module>
    from pysndfile.matapi import *
  File "C:\Python27\lib\site-packages\scikits\audiolab\pysndfile\matapi.py", line 145, in <module>
    Format('wav', 'pcm16').file_format)
  File "_sndfile.pyx", line 170, in scikits.audiolab.pysndfile._sndfile.Format.__init__ (scikits\audiolab\pysndfile\_sndfile.c:1429)
NameError: _SNDFILE_FILE_FORMAT

Is there a way to fix it? If not what should I use for audio processing instead? (Audiolab seemed to be the best alternative among audiotools and pyaudio)

EDIT:

After replacing libsndfile-1.dll, I have this new error:

Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    from scikits import audiolab
  File "C:\Python27\lib\site-packages\scikits\audiolab\__init__.py", line 25, in <module>
    from pysndfile import formatinfo, sndfile
  File "C:\Python27\lib\site-packages\scikits\audiolab\pysndfile\__init__.py", line 1, in <module>
    from _sndfile import Sndfile, Format, available_file_formats, \
  File "numpy.pxd", line 30, in scikits.audiolab.pysndfile._sndfile (scikits\audiolab\pysndfile\_sndfile.c:9632)
ValueError: numpy.dtype does not appear to be the correct type object

Note: numpy is installed.


Solution

  • As far as I can tell you need to install libsndfile-1.0.25 as is mentioned right where you downloaded the binary

    Scikits.audiolab is a package for audio file IO using numpy arrays. Linked against libsndfile-1.0.25.

    You can download an installer from here. You may need to reinstall the scikits.audiolab distribution after you install libsndfile (although honestly, I'm not sure).

    However, if this seems a lot of effort, it might be easier for you to install Python 2.6 and install audiolab from PyPi as scikits docs suggest. The PyPi version of scikits.audiolab is statically linked to libsndfile so you will not need to install it on your own.