Audiokit: Clicking noise when defaultToSpeaker = true

Created on 14 Apr 2020  Â·  4Comments  Â·  Source: AudioKit/AudioKit

Hi folks,
I'm noticing "clicking noises" in recording output after updating library from 4.9.2 to 4.9.5.
I've seen this has been mentioned in the past and apparently the issue is back (#1311 ).

I think this only happens when defaultToSpeaker is set to true.
Code: Sample code named "Recorder"

I'm testing that on iPhone 7 / iPhone XS.
No headphones plugged in.

Most helpful comment

@aure I can reproduce this bug with both 4.9.5 and 4.10.1. Would you be happy reopening it?

All 4 comments

Hello,#798 @sihwapark 's suggestion helped me, and when i didn't plug a headphone, i use the code below, it works for me. You can change it like this in the record demo and have a try. I think it is because need set the category and model of the audioSession before the mic init. If you use like this, you need self manager the audio session when the engine stop.

@aure hope dig the reason for it.

        // Session settings
        AKSettings.bufferLength = .medium
        AKSettings.defaultToSpeaker = false
        AKSettings.disableAVAudioSessionCategoryManagement = true
        AKSettings.disableAudioSessionDeactivationOnStop = true
        try? AVAudioSession.sharedInstance().setCategory(.playAndRecord)
        try? AVAudioSession.sharedInstance().overrideOutputAudioPort(.speaker)

//      do {
//          try AKSettings.setSession(category: .playAndRecord, with: .allowBluetoothA2DP)
//      } catch {
//          AKLog("Could not set session category.")
//      }
//
//      AKSettings.defaultToSpeaker = true


        mic = AKMicrophone()

@aure I can reproduce this bug with both 4.9.5 and 4.10.1. Would you be happy reopening it?

@tcwalther were you able to find a workaround for this? We're experiencing clicking noises on only a few specific models.

This is being addressed in the next version of AudioKit. It probably won't be fixed in 4.x

Was this page helpful?
0 / 5 - 0 ratings