Pregunta

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.

¿Fue útil?

Solución

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.

Otros consejos

I had the same problem on Mac OS. It's possible that you updated or installed a new version of python/numpy after you install audiolab. What I did is uninstall scikits.audiolab and reinstall it again, which got rid of this error

I had the same problem on Ubuntu 10.04.4 LTS. The reason was that the installed version of audiolab was for python2.5, but in the meantime with Ubuntu 10.04.4 LTS python was upgradee to version 2.6. After a new install of audiolab (wich grabbed the correct version) all's working fine.

All you need to do is to install libsndfile would have worked also.

brew install libsndfile
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top