title: Error in google cloud speech api synchronous speech recognition docs
body: <p>I copied the information from the google cloud speech api synchronous speech recognition docs at <a href="https://cloud.google.com/speech/docs/sync-recognize" rel="nofollow noreferrer">https://cloud.google.com/speech/docs/sync-recognize</a> into my code, but I when I ran the code I received a lot of errors:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/retry.py", line 121, in inner
      return to_call(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/retry.py", line 68, in inner
      return a_func(*updated_args, **kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/grpc/_channel.py", line 487, in __call__
      return _end_unary_response_blocking(state, call, False, deadline)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/grpc/_channel.py", line 437, in _end_unary_response_blocking
      raise _Rendezvous(state, None, None, deadline)
  grpc._channel._Rendezvous: &lt;_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, sample_rate_hertz (16000) in RecognitionConfig must either be omitted or match the value in the WAV header ( 44100).)&gt;
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "TESTINGAUDIO.py", line 27, in &lt;module&gt;
      print (transcribe_file("output.wav"))
    File "TESTINGAUDIO.py", line 20, in transcribe_file
      response = client.recognize(config, audio)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/cloud/gapic/speech/v1/speech_client.py", line 201, in recognize
      return self._recognize(request, options)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/api_callable.py", line 452, in inner
      return api_caller(api_call, this_settings, request)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/api_callable.py", line 438, in base_caller
      return api_call(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/api_callable.py", line 376, in inner
      return a_func(*args, **kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/retry.py", line 127, in inner
      ' classified as transient', exception)
  google.gax.errors.RetryError: RetryError(Exception occurred in retry method that was not classified as transient, caused by &lt;_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, sample_rate_hertz (16000) in RecognitionConfig must either be omitted or match the value in the WAV header ( 44100).)&gt;)
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>import os
  import io
  def transcribe_file(speech_file):
      """Transcribe the given audio file."""
      from google.cloud import speech
      from google.cloud.speech import enums
      from google.cloud.speech import types
      client = speech.SpeechClient()
  
      with io.open(speech_file, 'rb') as audio_file:
          content = audio_file.read()
  
      audio = types.RecognitionAudio(content=content)
      config = types.RecognitionConfig(
          encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16,
          sample_rate_hertz=16000,
          language_code='en-US')
  
      response = client.recognize(config, audio)
      # Each result is for a consecutive portion of the audio. Iterate through
      # them to get the transcripts for the entire audio file.
      for result in response.results:
          # The first alternative is the most likely one for this portion.
          print('Transcript: {}'.format(result.alternatives[0].transcript))
  
  print (transcribe_file("output.wav"))
  </code></pre>
  
  <p>Can someone please help me fix this error? </p>
  
  <p>Here is the second batch of errors after taking sorak's suggestion:</p>
  
  <pre><code>Traceback (most recent call last):
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/retry.py", line 121, in inner
      return to_call(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/retry.py", line 68, in inner
      return a_func(*updated_args, **kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/grpc/_channel.py", line 487, in __call__
      return _end_unary_response_blocking(state, call, False, deadline)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/grpc/_channel.py", line 437, in _end_unary_response_blocking
      raise _Rendezvous(state, None, None, deadline)
  grpc._channel._Rendezvous: &lt;_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, Must use single channel (mono) audio, but WAV header indicates 2 channels.)&gt;
  
  During handling of the above exception, another exception occurred:
  
  Traceback (most recent call last):
    File "TESTINGAUDIO.py", line 26, in &lt;module&gt;
      print (transcribe_file("output.wav"))
    File "TESTINGAUDIO.py", line 20, in transcribe_file
      response = client.recognize(config, audio)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/cloud/gapic/speech/v1/speech_client.py", line 201, in recognize
      return self._recognize(request, options)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/api_callable.py", line 452, in inner
      return api_caller(api_call, this_settings, request)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/api_callable.py", line 438, in base_caller
      return api_call(*args)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/api_callable.py", line 376, in inner
      return a_func(*args, **kwargs)
    File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/google/gax/retry.py", line 127, in inner
      ' classified as transient', exception)
  google.gax.errors.RetryError: RetryError(Exception occurred in retry method that was not classified as transient, caused by &lt;_Rendezvous of RPC that terminated with (StatusCode.INVALID_ARGUMENT, Must use single channel (mono) audio, but WAV header indicates 2 channels.)&gt;)
  </code></pre>