5

I'm trying to record an audio using Build-In Microphone and playback it simultaneously through Remote Speaker. I'm using AudioKit as follows:

import UIKit
import AudioKit

class ViewController: UIViewController {
    let session = AVAudioSession.sharedInstance()
    let mic = AKMicrophone()
    let reverb = AKReverb()

    override func viewDidLoad() {
        super.viewDidLoad()

        mic >>> reverb
        AudioKit.output = reverb
        AKSettings.ioBufferDuration = 0.002
    }

    @IBAction func buttonWasPressed() {
        printDevices()
        try! AudioKit.start()
        printDevices()
    }

    @IBAction func buttonWasReleased() {
        try! AudioKit.stop()
    }

    func printDevices() {
        // List of output devices:
        if let outputs = AudioKit.outputDevices {
            print("Outputs:")
            dump(outputs)
        }
    }
}

The problem is even when a Bluetooth speaker is connected after executing AudioKit.start() the only available output device is Build-In Receiver (So, there's no way to change AudioKit.output property).

Another problem is that after the launch of the app it also fails to determine remote speaker in the output devices, once it was re-opened it starts to work properly. So I wonder is there's a way to simultaneously use Build-In Mic and Remote Speaker? ..And a way to quit re-opening the app after it's launch every single time? -_-

Thanks a lot in advance!

goldwalk
  • 341
  • 1
  • 2
  • 11
  • 1
    Found the similar topic here: https://stackoverflow.com/questions/30614134/recording-from-built-in-mic-when-playing-through-bluetooth-in-ios But maybe things changed since the latest iOS release... – goldwalk Apr 12 '18 at 12:36
  • 1
    I've also ran into this problem. Have you found a workaround? – Artash Nov 26 '19 at 20:48

0 Answers0