title: I want to change the sample rate from my input node from 44100 to 8000
body: <p>I want to read the buffer from my microphone into an array, with 44.1khz its working fine but with the sample rate 8khz it comes to an error </p>
  
  <pre><code>ERROR:    &gt;avae&gt; AVAudioIONodeImpl.mm:884: SetOutputFormat: required condition is false: format.sampleRate == hwFormat.sampleRate
  2016-11-26 19:32:40.674 Atem[5800:1168274] *** Terminating app due to uncaught exception 'com.apple.coreaudio.avfaudio', reason: 'required condition is false: format.sampleRate == hwFormat.sampleRate'
  </code></pre>
  
  <p>with my following code : </p>
  
  <pre><code> var engine = AVAudioEngine()
      func setup() {
  
      print("new")
      let input = engine.inputNode!
      let bus = 0
  
      let mixer = AVAudioMixerNode()
      engine.attach(mixer)
  
      engine.connect(input, to: mixer, format: input.outputFormat(forBus: 0))
      //pcmFormatFloat64 -- pcmFormatFloat32
      print(engine.isRunning)
      let fmt = AVAudioFormat(commonFormat: .pcmFormatFloat32, sampleRate: 12000, channels: 1, interleaved: true)
  
      do {
          try engine.start()
  
  
       print(engine.isRunning)
  
          mixer.installTap(onBus: bus, bufferSize: 1024, format: fmt) { (buffer, time) -&gt; Void in
              // 8kHz buffers!
              print(buffer.format)
          }
      }catch {
          //print("An error occurred \(error)")
          return
      }
  
  }
  </code></pre>
  
  <p>can anyone help ?</p>