title: Python u-law issues: unknown format: 7
body: <p>I'm trying to compare two large sets of wav files to remove duplicates.  The issue is that one set is PCM, the other has been u-law'd.  When I try to read in PCM wav, no problem, but the u-law files give the following error:</p>
  
  <pre><code>&gt;&gt;&gt; wav = wave.open("C:\\soundfiles\\Olympus Recordings\\1019.wav")
  Traceback (most recent call last):
    File "&lt;stdin&gt;", line 1, in &lt;module&gt;
    File "C:\WinPython-64bit-3.4.3.3\python-3.4.3.amd64\lib\wave.py", line 497, in open
      return Wave_read(f)
    File "C:\WinPython-64bit-3.4.3.3\python-3.4.3.amd64\lib\wave.py", line 163, in __init__
      self.initfp(f)
    File "C:\WinPython-64bit-3.4.3.3\python-3.4.3.amd64\lib\wave.py", line 143, in initfp
      self._read_fmt_chunk(chunk)
    File "C:\WinPython-64bit-3.4.3.3\python-3.4.3.amd64\lib\wave.py", line 259, in _read_fmt_chunk
      raise Error('unknown format: %r' % (wFormatTag,))
  wave.Error: unknown format: 7
  </code></pre>
  
  <p>So I look in wave.py and find: </p>
  
  <pre><code> def _read_fmt_chunk(self, chunk):
          wFormatTag, self._nchannels, self._framerate, dwAvgBytesPerSec, wBlockAlign = struct.unpack_from('&lt;HHLLH', chunk.read(14))
          if wFormatTag == WAVE_FORMAT_PCM:
              sampwidth = struct.unpack_from('&lt;H', chunk.read(2))[0]
              self._sampwidth = (sampwidth + 7) // 8
          else:
              raise Error('unknown format: %r' % (wFormatTag,))
  </code></pre>
  
  <p>Does this mean python only handles un-ulaw'd wavs?  I don't know enough about audio to want to try hacking my python.</p>
  
  <p>I can play both kinds of files no problem, but looking at ulaw'd files in GSpot shows I'm missing codecs.</p>
  
  <p><img src="https://i.stack.imgur.com/Pdcms.png" alt="Codec NOT installed"></p>
  
  <p>Any ideas?  Maybe don't use python?  I like that numpy has a Fast Fourier Transform, I'd rather not try writing one.</p>