title: AudioKit - Routing Multi-Channel Signal Through App (macOS, swift)
body: <p>I am interested in developing an app using AudioKit that takes the 5.1 input, processes each channel differently, and then outputs it to a different output device. </p>
  
  <p>What I am attempting right now is to simply passthrough a stereo signal from one input device (Soundflower 2ch) and output it to the built in output (on my MBA).  </p>
  
  <p>In my code I get a list of available input and output devices and populate two popup menus.  When I make a selection with the popup menu it sets that device as the input or output.</p>
  
  <p><a href="https://i.stack.imgur.com/9wMij.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9wMij.png" alt="enter image description here"></a></p>
  
  <pre><code>func changeInputDevice() {
  
      let currentInputName = audioInputMenu.titleOfSelectedItem
      var currentInputID: UInt32 = 0
  
      if currentInputName == "None" {
          print("No input device selected")
          return
      }
  
      if let inputs = AudioKit.inputDevices {
          for device in inputs {
              if device.name == currentInputName {
                  currentInputID = device.deviceID
                  print("Number of channels: \(device.nInputChannels!)")
              }
          }
      }
  
      do {
          try AudioKit.setInputDevice(AKDevice(name: currentInputName!, deviceID: currentInputID))
          print("Input Device Initiated")
      } catch {
          print("error loading input device")
      }
  }
  </code></pre>
  
  <p>My question now is, where do I go from here to route the input audio to the output, and when working with more channels than stereo, how to I determine, which channel can go to which output?</p>
  
  <p>I've tried creating an AKMicrophone() and setting AudioKit.output to that microphone...</p>
  
  <pre><code>func startEngine() {
  
      let format = AVAudioFormat(standardFormatWithSampleRate: 48000, channels: 2)
  
      let inputChannels = AKMicrophone(with: format)
  
      AudioKit.output = inputChannels
  
      do {
          try AudioKit.start()
      } catch {
          print("error starting AudioKit Engine")
      }
  
  }
  </code></pre>
  
  <p>...but I get this error in the console:</p>
  
  <pre><code>2019-04-03 10:54:25.736287-0400 Studio EQ[6895:3586453] [avae] AVAEInternal.h:70:_AVAE_Check: required condition is false: [AVAudioIONodeImpl.mm:911:SetOutputFormat: (format.sampleRate == hwFormat.sampleRate)]
  </code></pre>
  
  <p>All input and output devices are set to 48kHz, 24bit on my system since that is what I use for work.  Is there another type of node I should be using?</p>