         do {
             AKSettings.audioInputEnabled = true
             AKSettings.defaultToSpeaker = true
-            AKSettings.sampleRate = AudioKit.engine.inputNode.inputFormat(forBus: 0).sampleRate
+//            AKSettings.sampleRate = AudioKit.engine.inputNode.inputFormat(forBus: 0).sampleRate
             try AKSettings.setSession(category: .playAndRecord)
 
             // Measurement mode can have an effect on latency.  But you end up having to boost everything.

        }

        // Make connections
        metronome.connect(to: mixer.inputNode)
        player.connect(to: mixer.inputNode)
        AudioKit.output = mixer

        // Set up recorders
        loopBackRecorder = AKClipRecorder(node: AudioKit.engine.inputNode)
        directRecorder = AKClipRecorder(node: metronome)

        do { try AudioKit.start() } catch {


class ViewController: UIViewController {

    let mic = AKMicrophone()
    var metronome = AKSamplerMetronome()
    var mixer = AKMixer()
    var loopBackRecorder: AKClipRecorder?
