AVAudioEngine input on Mac, disrupting low priority sounds

I am analysing sounds by tapping the mic on the Mac.

All is working well, but it disrupts other (what I assume) are low priority sounds e.g. dragging an item off the dock, sending a message is messages, speaking something in Shortcuts or Terminal. Other sounds like music.app playing, Siri speaking are not disrupted. The disruption sounds like the last part of the sound being repeated two extra times, very noticeable. This is the code:

import Cocoa
import AVFAudio

class AudioHelper: NSObject {
    let audioEngine = AVAudioEngine()

    
    func start() async throws {

        
        audioEngine.inputNode.installTap(onBus: 0, bufferSize: 8192, format: nil) { buffer, time in
 
        }
        
        try audioEngine.start()
    }
}

I have tried increasing the buffer, changing the qos to utility (in the hope the sound analysis would become less important than the disrupted sounds),running on a non-main thread, but no luck. MacOS 13.4.1

Any assistance would be appreciated.

Post not yet marked as solved Up vote post of moonmonkey Down vote post of moonmonkey
943 views
Add a Comment

Replies

Can confirm, seeing the same thing, on 13.4 (22F66).