AIFF-C file cannot be read with aifc module in python
Question: I am trying to read a compressed .aiff file stored on my local directory. I
get this;

    
    
    >>>import aifc
    >>>s = aifc.open('/Users/machinename/Desktop/folder/AudioTrack.aiff','r')
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py",     line 942, in open
    return Aifc_read(f)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py", line 347, in __init__
    self.initfp(f)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py", line 317, in initfp
    self._read_comm_chunk(chunk)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/aifc.py", line 497, in _read_comm_chunk
    raise Error, 'cannot read compressed AIFF-C files'
    aifc.Error: cannot read compressed AIFF-C files
    >>>
    

I believe there must be a workaround for this.
[Here](https://docs.python.org/2/library/aifc.html) you can see
[aifc](https://docs.python.org/2/library/aifc.html) is supports aiff-c files
as well.

A simple question, yet I could not find a solution on the web.


Answer: you might find that
[scikits.audiolab](https://pypi.python.org/pypi/scikits.audiolab/) (requires
mega-nerd.com/libsndfile/ is installed) does what you need. For example, I
recently needed to get the duration of an .aif file (in seconds):

    
    
    import scikits.audiolab
    
    aiff_file = scikits.audiolab.Sndfile('best_song_ever.aif')
    print aiff_file.nframes / float(aiff_file.samplerate)
    

You can do a bunch of other cool stuff too ([Full API
docs](http://cournape.github.io/audiolab/fullapi.html)). I hope that helps!

