title: PyAudio throws ´unable to open slave` error
body: <p>Hi every time i execute pyauido.PyAudio() i get the following error.
  I try to display the audio recorded by my mic using these instructions: <a href="https://swharden.com/wp/2016-07-19-realtime-audio-visualization-in-python/" rel="nofollow noreferrer">https://swharden.com/wp/2016-07-19-realtime-audio-visualization-in-python/</a>
  and use my USB-Mic and the headphone-jack of my raspberry pi 3+</p>
  <pre><code>Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &amp;alsaPer                                  iodFrames, &amp;dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
  Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &amp;alsaPer                                   iodFrames, &amp;dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
  ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
  ALSA lib pcm.c:2565:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
  ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
  Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &amp;alsaPer                                   iodFrames, &amp;dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924 
  </code></pre>
  <p>Update: As mentioned in the comments i got rid of the &quot;Unknown PCM&quot; by editing the alsa.conf file, but i realised that the traceback was not added to the snippet i posted here so here is the &quot;new, complete&quot;-Message:</p>
  <pre><code>Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &amp;alsaPeriodFrames, &amp;dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
  ALSA lib pcm_dsnoop.c:638:(snd_pcm_dsnoop_open) unable to open slave
  ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
  ALSA lib pcm_dmix.c:1108:(snd_pcm_dmix_open) unable to open slave
  Expression 'alsa_snd_pcm_hw_params_set_period_size_near( pcm, hwParams, &amp;alsaPeriodFrames, &amp;dir )' failed in 'src/hostapi/alsa/pa_linux_alsa.c', line: 924
  Traceback (most recent call last):
    File &quot;sound.py&quot;, line 9, in &lt;module&gt;
      frames_per_buffer=CHUNK)
    File &quot;/usr/lib/python2.7/dist-packages/pyaudio.py&quot;, line 750, in open
      stream = Stream(self, *args, **kwargs)
    File &quot;/usr/lib/python2.7/dist-packages/pyaudio.py&quot;, line 441, in __init__
      self._stream = pa.open(**arguments)
  IOError: [Errno -9996] Invalid input device (no default output device)
  </code></pre>
  <p>Additional information:</p>
  <pre><code>**** List of CAPTURE Hardware Devices ****
  card 2: Device [USB PnP Audio Device], device 0: USB Audio [USB Audio]
    Subdevices: 1/1
    Subdevice #0: subdevice #0
  </code></pre>
  <pre><code>[12:06:02] openhabian@openhab:~$ aplay -l
  **** List of PLAYBACK Hardware Devices ****
  card 0: b1 [bcm2835 HDMI 1], device 0: bcm2835 HDMI 1 [bcm2835 HDMI 1]
    Subdevices: 4/4
    Subdevice #0: subdevice #0
    Subdevice #1: subdevice #1
    Subdevice #2: subdevice #2
    Subdevice #3: subdevice #3
  card 1: Headphones [bcm2835 Headphones], device 0: bcm2835 Headphones [bcm2835 Headphones]
    Subdevices: 4/4
    Subdevice #0: subdevice #0
    Subdevice #1: subdevice #1
    Subdevice #2: subdevice #2
    Subdevice #3: subdevice #3
  </code></pre>
  <p>.asoundrc - configuration:</p>
  <pre><code>
  pcm.!default {
    type asym
    capture.pcm &quot;hw:2,0&quot;
    playback.pcm &quot;hw:1,0&quot;
  }
  
  </code></pre>