views:

501

answers:

1

I've been using Audiolab to import sound files in the past, and it worked quite well. However:

-

In [2]: from scikits import audiolab
--------------------------------------------------------------------

ImportError                               Traceback (most recent call last)

C:\Python26\Scripts\<ipython console> in <module>()

C:\Python26\lib\site-packages\scikits\audiolab\__init__.py in <module>()
     23 __version__ = _version
     24
---> 25 from pysndfile import formatinfo, sndfile
     26 from pysndfile import supported_format, supported_endianness, \
     27                       supported_encoding, PyaudioException, \

C:\Python26\lib\site-packages\scikits\audiolab\pysndfile\__init__.py in <module>()
----> 1 from _sndfile import Sndfile, Format, available_file_formats, available_encodings
      2 from compat import formatinfo, sndfile, PyaudioException, PyaudioIOError
      3 from compat import supported_format, supported_endianness, supported_encoding

ImportError: DLL load failed: The specified module could not be found.``

So I would like to either:

  • Figure out why it's not working in 2.6 (something wrong with _sndfile.pyd?) and maybe find a way to extend it to work with unsupported formats
  • Find a complete replacement for audiolab
+1  A: 

Audiolab is working for me on Ubuntu 9.04 with Python 2.6.2, so it might be a Windows problem. In your link to the forum, the author also suggests that it is a Windows error.

In the past, this option has worked for me, too:

from scipy.io import wavfile
fs, data = wavfile.read(filename)

Just beware that data may have int data type, so it is not scaled within [-1,1). For example, if data is int16, you must divide data by 2**15 to scale within [-1,1).

Steve
Can scipy.io read 24-bit WAVs?
endolith
I'm not certain about that. 16- or 32-bit should be fine, but I don't know about 24-bit.
Steve
It doesn't read much of anything. Even 16-bit files come out inverted, with wraparound errors for a value of -1. 24-bit gets "TypeError: data type not understood" Surely there's something better...
endolith
Can you post a file which gives you this error ? Also, does the test suite passes correctly (scikits.audiolab.test()) ? audiolab uses libsndfile, which is by far the best and most reliable audio IO library that I know. There may be an error in audiolab itself, of course
David Cournapeau
I don't see the wraparound bug now, but that was a bug with scipy.io, not audiolab.
endolith