title: Python, speech_recognition tool does not recognize .wav file
body: <p>I have generated a .wav audio file containing some speech with some other interference speech in the background. 
  This code worked for me for a test .wav file:</p>
  
  <pre><code>    import speech_recognition as sr
  
      r = sr.Recognizer()
      with sr.WavFile(wav_path) as source:
          audio = r.record(source)
  
      text = r.recognize_google(audio)
  </code></pre>
  
  <p>If I use my .wav file, I get the following error:</p>
  
  <blockquote>
    <p>ValueError: Audio file could not be read as PCM WAV, AIFF/AIFF-C, or Native FLAC; check if file is corrupted or in another format</p>
  </blockquote>
  
  <p>The situation slightly improves if I save this .wav file with soundfile:</p>
  
  <pre><code>    import soundfile as sf        
  
      wav, samplerate = sf.read(wav_path)
      sf.write(saved_wav_path, original_wav, fs)
  </code></pre>
  
  <p>and then load the new saved_wav_path back into the first block of code, this time I get:</p>
  
  <blockquote>
    <p>if not isinstance(actual_result, dict) or len(actual_result.get("alternative", [])) == 0: raise UnknownValueError()</p>
  </blockquote>
  
  <p>The audio files were saved as</p>
  
  <pre><code>    wavfile.write(wav_path, fs, data)
  </code></pre>
  
  <p>where wav_path = 'data.wav'. Any ideas?</p>
  
  <p>SOLUTION:</p>
  
  <p>Saving the audio data the following way generates the correct .wav files:</p>
  
  <pre><code>    import wavio
      wavio.write(wav_path, data, fs ,sampwidth=2)
  </code></pre>