title: How can we use microphone in google colab?
body: <p>OSError Traceback (most recent call last)</p>
  
  <pre><code>&lt;ipython-input-21-4159a88154c9&gt; in &lt;module&gt;()
        7 response = google_images_download.googleimagesdownload()
        8 r = sr.Recognizer()
  ----&gt; 9 with sr.Microphone() as source:
       10     print("Say something!")
       11     audio = r.listen(source)
  </code></pre>
  
  <p>/usr/local/lib/python3.6/dist-packages/speech_recognition/<strong>init</strong>.py in <strong>init</strong>(self, device_index, sample_rate, chunk_size)</p>
  
  <pre><code> 84 assert 0 &lt;= device_index &lt; count, "Device index out of range ({} devices available; device index should be between 0 and {} inclusive)".format(count, count - 1)
       85 if sample_rate is None:  # automatically set the sample rate to the hardware's default sample rate if not specified
  ---&gt; 86 device_info = audio.get_device_inf  o_by_index(device_index) if device_index is not None else audio.get_default_input_device_info()
       87 assert isinstance(device_info.get("defaultSampleRate"), (float, int)) and device_info["defaultSampleRate"] &gt; 0, "Invalid device info returned from PyAudio: {}".format(device_info)
       88 sample_rate = int(device_info["defaultSampleRate"])
  </code></pre>