AVAudioSession

RSS for tag

Use the AVAudioSession object to communicate to the system how you intend to use audio in your app.

Posts under AVAudioSession tag

200 Posts

Post

Replies

Boosts

Views

Activity

audiomxd terminated for memory limit during short audio playback with background music
Hello, I need guidance on diagnosing an intermittent audio failure on an iPhone 12 running iOS 26.6.2. My app, Timer Workout Fitness, plays short bundled MP3 voice recordings for countdowns, repetition numbers and workout announcements. It uses React Native / Expo SDK 57 and expo-audio. The native playback implementation uses AVQueuePlayer, AVPlayerItem and AVURLAsset. Users can listen to Spotify while the app plays spoken cues, with ducking of the background music. Observed behavior: Playback can work correctly for an entire workout. Audio sometimes fails after background/foreground transitions, pausing Spotify, or completing one workout and starting another. The exact sequence is not consistently reproducible. The app may remain navigable while recorded audio becomes unavailable. Force-quitting does not always restore reliable playback. Restarting the iPhone has restored it in our tests. Speech-based voices have generally behaved more reliably before the failure. Evidence from a device Console capture: At 15:03:35 on October 12, the kernel reported termination of audiomxd with reason "per-process-limit" and a recorded footprint of 66866 KB. ReportSystemMemory confirmed the jetsam termination. Shortly before this, the Console contained AudioConverter construction messages associated with our app through mediaplaybackd. Our app subsequently reported media-services loss/reset and errors including: "Server was dead" OSStatus 1836282486 We have not established whether our playback implementation causes an accumulation of native resources, a temporary peak, or another issue. We do not assume that this is an iOS defect. The implementation originally retained up to 56 players for individual recordings and loaded them concurrently. We recently changed it to load only the recordings required by a workout: 15 players for 10 repetitions and 35 for 30 repetitions. Failures have still occurred in development testing, but we have not measured the corresponding native memory footprint. We also have a custom native patch affecting activation/deactivation and handling of media-services loss/reset. Current Expo Go tests do not include that patch; our TestFlight builds do. We can provide the patch for review. What is the recommended way to: Attribute audiomxd memory usage to our app’s playback resources? Verify that AVQueuePlayer items and associated decoding resources are released? Capture useful diagnostics for this service termination? Choose an appropriate playback architecture for frequent short local voice clips alongside background music? We have device Console logs and application diagnostic traces. We do not yet have a minimal native Xcode reproduction project and would appreciate guidance on what it should include.
0
0
24
7h
Issues with AVRoutePickerView channel switching
We are developing a voice call application that uses AVRoutePickerView, allowing users to switch between an iPhone, a speaker, and Bluetooth earphones. However, we have encountered an intermittent issue: when switching from the speaker to Bluetooth earphones, the earphones remain in a loading state, and the audio channel subsequently switches back to the speaker. How can we resolve this issue? Here is the sample code: let session = AVAudioSession.sharedInstance() do { try session.setCategory(.playAndRecord, mode: .default, options: [.allowBluetooth]) try session.overrideOutputAudioPort(isBluetoothConnected ? .none : .speaker) try session.setPreferredSampleRate(48000) try session.setPreferredIOBufferDuration(0.02) try session.setActive(true, options: []) INFO(" >>> start: hasBluetooth=\(isBluetoothConnected), inputs: \(session.currentRoute.inputs.map { $0.portType }) outputs: \(session.currentRoute.outputs.map { $0.portType })") } catch { ERROR("(error.localizedDescription)") }
5
0
1.8k
3d
AVSpeechSynthesizer audio pauses when the device locks, despite an active background AVAudioSession
My App announces a place name aloud via AVSpeechSynthesizer (through expo-speech) while a background location task detects the user has entered a new town. This works correctly in the foreground. In the background, with the device screen locked, speech that has already started reliably pauses mid-utterance the moment the screen locks, and resumes and completes the moment the screen is unlocked — even though: The app has UIBackgroundModes: ['audio', 'location'] declared. A genuinely active, native-confirmed AVAudioSession is already running continuously in the background (a looping AVAudioPlayer via expo-audio, separate from the speech itself). AVSpeechSynthesizer.usesApplicationAudioSession is at its default (true), so the synthesizer shares that same active session rather than managing its own. This is not a crash, and AVSpeechSynthesizer never reports onError, the utterance simply stalls and then continues later, which looks exactly like a pause/resume cycle tied to the screen lock event itself rather than any audio session interruption we can detect. What is implemented app.config.js declares the audio and location background modes, and expo-audio's config plugin with enableBackgroundPlayback: true. At app launch, expo-audio's setAudioModeAsync is called once with: { playsInSilentMode: true, shouldPlayInBackground: true, interruptionMode: 'duckOthers' } (We also tested interruptionMode: 'doNotMix' see below.) For the duration of a tracked journey, a silent/near-silent AVAudioPlayer-backed loop is started via expo-audio's createAudioPlayer(), specifically so the app has genuine continuous audio output (not just a configured session) for the whole background session. The player is also registered as the active Now Playing session via setActiveForLockScreen() (expo-audio's wrapper around MPNowPlayingInfoCenter / MPRemoteCommandCenter). When a new place is detected (from a background expo-location task), we call Speech.speak() with the place name. onStart, onDone, onStopped, and onError callbacks are all logged for diagnostics. 5. We listen to the player's native playbackStatusUpdate event to know, from real OS-reported status (not just "the .play() call didn't throw"), whether the keep-alive loop is actually playing. Observed behavior: field test evidence Device log example (stationary repeated test): 08:29:01.948 onStart 08:29:02.092 keep-alive loop confirmed playing (native status) 08:29:07.666 onDone That's a 5.7s onStart-to-onDone gap for a phrase that normally takes under 2s — consistent with the utterance pausing mid-speech when the screen locked, then resuming on unlock. A separate test that stayed unlocked completed the same kind of phrase in 1.9s. On a real 68-minute drive, locked cycles showed 9.4-12.5s gaps; some builds with more aggressive session-reactivation never completed at all (onStart with no onDone/onStopped/onError). Throughout, the background AVAudioPlayer loop's native status still reports playing: true, and Control Center shows the app as Now Playing. So the AVAudioSession is confirmably alive — only the speech utterance itself stalls on lock. What we've ruled out: usesApplicationAudioSession already defaults to true (confirmed via WWDC 2020 session 10022), the synthesizer already shares our configured session, this isn't a missing option. Tried both doNotMix and duckOthers interruption modes. Neither stops the pause-on-lock. duckOthers additionally stops the app showing as Now Playing in Control Center (doNotMix does show it). Keep-alive liveness: native playback status confirms the background AVAudioPlayer reaches playing: true within 100-800ms every time — the session itself isn't failing to activate. We can't observe AVAudioSessionInterruptionNotification directly from our React Native audio libraries, only each library's own polled status — so we can't confirm whether a real interruption notification fires at the moment of lock. That's one of our questions below. Questions: Is it expected that AVSpeechSynthesizer, with usesApplicationAudioSession=true and an already-active background AVAudioSession (.playback category, UIBackgroundModes including audio), still pauses an in-progress utterance when the screen locks and resumes on unlock? If so, is there a supported way to prevent that for a navigation/voice-prompt app? Does locking the screen alone generate an AVAudioSessionInterruptionNotification for an app in this configuration, and if so what interruption type is reported? We can't observe this through our current libraries and want to know what native behavior to expect. Apple's "Audio Guidelines By App Type" doc gives two sets of guidance that both partly apply to us: navigation apps (activate the session only when a prompt is needed, deactivate after, use duckOthers) vs. playback apps (don't stream silence to avoid suspension, use a background task instead). Is there a recommended pattern for an app needing short, infrequent spoken prompts to continue through a locked screen, triggered by a background location task rather than continuous media playback?
0
0
312
1w
UX pain point - iOS - Stopping foreground apps from cutting audio - Neurodivergent users
TL;DR Requesting a system-level iOS feature or API to prioritize background audio over foreground app interruptions for enhanced neurodivergent accessibility. Granular Audio Session Priority and Control Center Override For users who rely on parallel cognitive processing - such as neurodivergent individuals managing attention through sensory layering like jumping across apps - abrupt audio interruptions are deeply disruptive. One scenario - a user is deep in cognitive flow listening to audio via Apple Music. They then switch to Instagram to check a text or post as natural neurodivergent attention switching and a video automatically fires up audio and instantly cuts the track playing on Apple Music. Regaining the audio stream requires manual intervention and therefore a breaking of focus. Proposal - I would love and suggest a native iOS feature or Control Center overlay allowing users to define audio hierarchy across apps, e.g. by locking background media as primary; open for ideas of course. This may as well be useful in therapeutical setups to easily silence potential notifications of lower priority over audio media designed to sensorically set guidelines for a session. Scope - while potentially helpful to users in the audio engineering and music playing scene running third-party-apps like Ableton and such, the feature request is intended to assist a basic and non-teh-savvy iOS user. Technical Question - is there any undocumented or upcoming capability within ⁠AVAudioSession⁠ categories/modes that could allow a developer to gracefully intercept or suppress automatic audio ducking/interruption from third-party foreground apps? PS First post. Nothing similar found on the forum. Nice request. Would love feedback or a technical review on feasibility.
0
0
292
1w
watchOS 27 TTS/Bluetooth Issue
When playing TTS on a watchOS 27 device while AirPods or a Bluetooth headset are connected to both the Apple Watch and the iPhone: Playback begins by calling the setActive function of AVAudioSession. A successful response is received, but... ...AVAudioSession.currentRoute.outputs lists only the built-in speaker, with no entry for the Bluetooth headset or earphones. After a brief delay, an AVAudioSession.routeChangeNotification is received, and playback then switches to the AirPods. If TTS is stopped and playback is attempted again: Playback frequently fails. In this state, AVAudioSession.currentRoute.outputs still shows no Bluetooth headset or earphones. However, checking the Bluetooth settings on the Apple Watch confirms that the AirPods or Bluetooth headset are properly connected. If the app is restarted—or if you exit and re-enter the TTS playback screen—the first attempt succeeds (albeit with a delay), but subsequent attempts after stopping fail. Sometimes, playback fails right from the start. Even in this case, the AirPods remain properly connected. The issue is resolved if the AirPods are disconnected from the iPhone and connected solely to the Apple Watch. When connected only to the watch, AVAudioSession.currentRoute.outputs correctly includes the Bluetooth headset or earphones from the start, and playback issues do not occur when repeatedly stopping and restarting. Playback worked fine with simultaneous Bluetooth connections up to watchOS 26, but a strange issue has started occurring since watchOS 27. We suspect this is a bug or error introduced in watchOS 27; could you please fix it? The same issue persists even after the recent update to version 27.0.1. Alternatively, please let us know if there is a way to resolve this within the app itself. It seems impossible to fix this in the current code because there is no way to programmatically trigger a popup on the Apple Watch that forces the selection of a currently connected Bluetooth headset or AirPods. Also, it does not appear to be an issue with the TTS API.
0
0
356
1w
iPad (9th gen) headphone output ~2.5 to 4.5 dB quieter on iPadOS 27 (FB24980117)
Since iPadOS 27, the 3.5 mm headphone output on iPad (9th generation) is 2.4 to 4.5 dB quieter than on iPadOS 26, depending on frequency, with the same content, system volume and headphones. It's still present in iPadOS 27.2 beta 2 (24B5089g). It isn't app-specific. It reproduces in Safari: Connect wired headphones to the 3.5 mm jack and set system volume to 100%. Open https://www.szynalski.com/tone-generator/, set 3000 Hz, set the generator volume to 50%, and play. Measure with a sound level meter. At 3 kHz we see 2.5 to 2.9 dB less on iPadOS 27 than on iPadOS 26, across three different headphone models. Audio settings are identical between the two OS versions and Bluetooth is off. The only session-level difference we found is AVAudioSession.outputLatency, which went from 97 to 65 frames. Filed as FB24980117.
0
0
389
2w
CallKit does not activate audio session with higher probability after upgrading to iOS 18.4.1
Hi, We've noticed that this issue occurs more frequently after upgrading to iOS 18.4.1 and can result in one-way audio. Our app uses CallKit with WebRTC to establish VoIP connections. However, on iOS 18.4.1, CallKit no longer triggers: func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) We're currently comparing the occurrence rate across different iOS versions to better understand the impact. Could you please help analyze the root cause of this issue?
40
1
5.3k
3w
Low-latency, high-quality audio route w/wireless CarPlay?
Is there a supported way for a CarPlay audio app to request a lower-latency wireless playback route without communications-style audio processing or restricted volume behavior? .playback + .default on wired CarPlay gets you ~60ms latency route. The same on wireless CarPlay gets you ~1100ms latency. I know that wireless CarPlay can support faster connections as I have tested them. playAndRecord + .default and .playback + .voicePrompt negotiate approximately 160 ms output/presentation latency. However, on this head unit those paths have unacceptable side effects: The duplex route negotiates 24 kHz mono and removes or severely attenuates bass/haptic-engine content. The voice-prompt route alters volume semantics: steering-wheel/head-unit volume does not control our app’s level, and it appears to apply voice-oriented EQ or other processing. These routes therefore cannot substitute for full-bandwidth media playback, even though their latency is much better. 24 kHz mono would actually work for our app, if only it preserved the signal without voice/telephony EQ, bass removal, or special prompt-bus volume policy. Is there a documented, supported public API or AVAudioSession configuration (or other API even) that lets a CarPlay audio app request that kind of low-latency wireless media route? If not, is this an intentional limitation of wireless CarPlay media playback, and is there an appropriate enhancement-request path for real-time audio applications?
0
0
316
4w
Does the TN3135 audio-session networking exception have a defined lifetime? Seeing a ~38.5 s revoke/re-grant cycle
TN3135 describes the exception that lets a watchOS app use low-level networking while it holds an active audio session. I have that working, and the app functions — but the network path is withdrawn and restored on a strikingly regular cycle, and I would like to know whether that is expected behaviour rather than something I am doing wrong. Setup Apple Watch Series 10 (Watch7,9), watchOS 26.5. Reproduced on a Series 6 (Watch6,2). UIBackgroundModes: [audio]; AVAudioSession category .playAndRecord, mode .spokenAudio; activated with the async activate(options:completionHandler:). NWConnection with NWProtocolWebSocket to a WebSocket relay over TLS. The app streams 16 kHz mono PCM continuously while transmitting and holds the socket open otherwise. Symptom NWPathMonitor reports .unsatisfied, then .satisfied about two seconds later, over and over. Measured with the iPhone powered off, so the watch was on its own Wi-Fi: Uptime between drops Outage 36.4 s 2.1 s 36.7 s 1.9 s 36.9 s 2.1 s The regularity is what prompts the question — uptime varies by ±0.3 s and the outage is consistently 2.0 s. That reads as a timeout expiring rather than radio behaviour. What I have ruled out Not the network or the server. A browser client on the same relay, same TLS, same wire protocol, holds a WebSocket indefinitely. Not the interface. Identical cadence over the companion ipsec1 tunnel with the iPhone present, and over the watch's own en0 with the iPhone powered off. Pinning requiredInterfaceType = .wifi while the iPhone is reachable fails outright — the path offers only ipsec1. Not audio-session interruption. I observe interruptionNotification, routeChangeNotification, mediaServicesWereResetNotification and silenceSecondaryAudioHintNotification. None fire at a drop. At the moment the path goes .unsatisfied, the engine is running and the player node is actively playing. Not session idleness. Playing continuous silence for the whole session, rather than only while reconnecting, made no difference — still 36.4 s. The control that surprised me To test whether this affects any long-lived watch socket or only audio-unlocked ones, I built a second app with no AVAudioSession at all, no audio background mode, holding a URLSessionWebSocketTask and kept alive by a WKExtendedRuntimeSession so screen sleep was not a factor. It never connected. NWPathMonitor reported .unsatisfied once and never changed, across a 30 s run, and every request failed with "The Internet connection appears to be offline." I had expected URLSession to be permitted regardless. Questions Does the audio-session networking exception in TN3135 have a defined lifetime, and is a periodic revoke/re-grant cycle expected? If so, is there a supported way to hold it continuously — or is the correct design simply to expect the interruption and reconnect through it? Is it expected that an app with no audio session gets no network path at all on watchOS, including via URLSession, even in the foreground with an extended runtime session?
16
0
3.8k
Sep ’26
AirPods Sleep Detection pauses meditation playback with no API/callback to identify the reason
Good morning! I work on a meditation app, and since Sleep Detection was introduced for AirPods in iOS 26, we've been receiving complaints from users reporting that their meditation sessions unexpectedly stop after approximately 15–20 minutes when Sleep Detection is enabled. This seems to happen particularly during deep meditation sessions, where the user may remain still and exhibit behavior that could potentially be interpreted as falling asleep. I've also tested this on iOS 27 with the latest beta firmware available for AirPods Pro, and the same behavior still occurs. While investigating and debugging the issue, I found that there doesn't appear to be any public API that allows an app to determine that playback was paused specifically because of AirPods Sleep Detection. From the application's perspective, the AirPods appear to simply send a standard pause command to the AVPlayer, without providing any additional context or reason. There also doesn't seem to be an API that allows us to determine whether the user has Sleep Detection enabled. Even having access to that information would allow us to warn users that their meditation session could potentially be interrupted. AVAudioSession.InterruptionReason does not seem to help in this case either: https://developer.apple.com/documentation/avfaudio/avaudiosession/interruptionreason Is there currently any supported way for an app to: Detect that playback was paused specifically because of AirPods Sleep Detection? Determine whether Sleep Detection is enabled for the connected AirPods? Prevent Sleep Detection from pausing playback for specific apps or specific types of audio sessions? If none of these are currently possible, could Apple consider providing either a notification/callback indicating that Sleep Detection triggered the pause, or an option for users to exclude specific apps from Sleep Detection? This behavior is particularly problematic for meditation apps, since a user in a deep meditation session can easily be mistaken for someone who has fallen asleep. Other meditation apps appear to be affected by the same behavior as well. Best regards, Carlos Antunes
1
0
1.2k
Sep ’26
Can an iOS app programmatically enable Voice Isolation microphone mode?
Hi, I’m developing an iOS app that captures the user’s voice and sends the microphone input to an AI model for speech processing. For this use case, Voice Isolation provides a significantly better input signal in noisy environments. However, I’m currently unable to enable Voice Isolation programmatically when the app starts recording. As I understand it, microphone modes such as Automatic, Standard, Voice Isolation, and Wide Spectrum are controlled by the user through the system UI. My app can detect/observe the current microphone mode, but I have not found a public API that allows the app to select Voice Isolation itself. My questions are: Is there currently a supported public API to programmatically switch the microphone mode from Automatic/Standard → Voice Isolation? If direct selection is not supported, is there a recommended way for an app that primarily processes speech/voice input for an AI model to request or prefer Voice Isolation? Would using AVAudioSession with an appropriate voice-processing configuration, such as .voiceChat, or enabling voice processing through AVAudioEngine, provide equivalent Voice Isolation processing? Is AVCaptureDevice.showSystemUserInterface(.microphoneModes) the intended approach when an app needs the user to change the microphone mode? I understand that Apple may intentionally keep microphone-mode selection under user control. I’m mainly trying to determine whether there is a supported programmatic approach that I may have overlooked, rather than relying on a custom noise-suppression implementation. Any guidance on the recommended architecture for this use case would be greatly appreciated. Thank you!
0
0
621
Sep ’26
PushToTalk session sometimes returns silence data after activation
Hello! Thank you for bringing the new iPhone experience with the PushToTalk framework. I have a working walkie talkie app based on the PushToTalk framework. Everything works fine except for an intermittent bug that I face from time to time on different devices with different iOS versions, from iOS 18 to iOS 26.2 Beta. Sometimes the app goes into a state where the AVAudioInputNode input node tap returns buffers with a constant size that contain only silence. Leaving and rejoining a channel helps, but relaunching or reinstalling (from Xcode) the app does not. Rebooting the device or deleting and reinstalling the app also helps. I do not activate the audio session in my app. I only configure it on launch using setCategory(.playAndRecord, options: [.defaultToSpeaker, .allowBluetooth]) So the flow is: channelManager?.requestBeginTransmitting(channelUUID: globalChannelUUID) func channelManager( _ channelManager: PTChannelManager, channelUUID: UUID, didBeginTransmittingFrom source: PTChannelTransmitRequestSource ) func channelManager( _ channelManager: PTChannelManager, didActivate audioSession: AVAudioSession ) { /// ... installTapAndStart() } private func installTapAndStart() { let inputNode = audioEngine.inputNode let hardwareFormat = inputNode.outputFormat(forBus: 0) guard let targetFormat = AVAudioFormat( commonFormat: .pcmFormatFloat32, sampleRate: configuration.audioSampleRate, channels: configuration.audioChannelsCount, interleaved: true ) else { handleError(RecorderError.invalidAudioFormat) return } let converter = AVAudioConverter(from: hardwareFormat, to: targetFormat)! print("[QUICOpusRecorder]: installTap") inputNode.installTap(onBus: 0, bufferSize: tapBufferSize, format: hardwareFormat) { [weak self] buffer, _ in guard let self else { return } // Here I handle audio data and sometimes get silence } //... do { audioEngine.prepare() try audioEngine.start() } catch { print(" ⚠️ Audio engine start error: \(error)") handleError(error) } } Moreover, if the app is in the foreground and PushToTalk gets stuck in this “silence bug”, I can avoid relying on the PushToTalk flow and simulate audio session activation manually in code. In this case I do not request a transmission and do not use any PushToTalk related code, and the app captures audio data perfectly. Once I leave the channel and rejoin it again, the issue is fixed and I start to receive non silent buffers of varying size, as expected. It works for a while. It can work fine for a day or more, communicating without launching the app, or with the app in the foreground. But it can also go into the “silence” state 30 minutes after working normally. I have no clue why this happens. The only thing I notice is that when the app is in this “stuck silence bug” state, iOS does not play its “chirp” system sound when audio recording starts. P.S. Channel descriptor restoration code: extension PushToTalkEngine: PTChannelRestorationDelegate { public func channelDescriptor(restoredChannelUUID channelUUID: UUID) -> PTChannelDescriptor { print("☀️ \(#function) channelUUID: \(channelUUID)") Task { @MainActor in // Here I fetch more detailed channel data asynchronously do { await initChannelManagerIfNeeded(channelUUID: channelUUID) let channelDescriptor = currentChannelDescriptor() lastChannelDescriptorName = channelDescriptor.name try await channelManager?.setChannelDescriptor( channelDescriptor, channelUUID: channelUUID ) } catch { handleError(error) } } return PTChannelDescriptor(name: "Loading...", image: nil) } } private func initChannelManagerIfNeeded(channelUUID: UUID? = nil) async { guard let channelUUID = channelUUID ?? currentUser?.globalChannelUUID else { print("❌ No global channel uuid found") return } do { guard channelManager == nil else { try await channelManager?.setTransmissionMode(.halfDuplex, channelUUID: channelUUID) return } channelManager = try await PTChannelManager.channelManager( delegate: self, restorationDelegate: self ) try await channelManager?.setTransmissionMode(.halfDuplex, channelUUID: channelUUID) } catch { handleError(error) } }
4
0
1.5k
Aug ’26
provider(_:didActivate:) callback intermittently not triggered, causing widespread audio loss for users
Hi everyone, I am facing a critical issue where the CallKit provider delegate method provider(_:didActivate:) is intermittently not triggered. This occasionally results in a total loss of audio during some VoIP calls, while other calls work perfectly fine. Here is the sequence of steps I am currently implementing: Report Incoming Call: The app receives a VoIP push notification and reports the call using reportNewIncomingCall(with:update:completion:). Answer Action: The user taps the answer button, and the app processes the CXAnswerCallAction. Configure Audio Session: Inside the provider delegate, I configure the AVAudioSession category and mode (e.g., setting category to .playAndRecord and mode to .voiceChat). Note: As per Apple's guidelines, I do not call setActive(true) manually, expecting CallKit to activate it automatically. Despite following this standard flow, there are times when provider(_:didActivate:) is skipped entirely, meaning the audio engine fails to initialize for that specific call session. We are currently receiving a large volume of user complaints regarding this issue, as it heavily impacts the core calling experience in production. Could an Apple engineer or anyone from the community look into this? Any insights into what might be causing CallKit to occasionally fail to activate the audio session or how to work around this would be highly appreciated. Thank you!
5
0
1.2k
Aug ’26
Preserve AirPods Transparency while capturing one AirPod microphone for low latency cross ear audio
I am prototyping an iOS accessibility audio application for people with unilateral hearing loss. The goal is simple. Capture environmental audio using the AirPod on the poor hearing side and route that audio with very low latency into the AirPod on the working hearing side. The core concept is already working on physical AirPods and an iPhone. Our desired signal path is Right AirPod microphone → iPhone audio processing → Left AirPod output The user sets the AirPods microphone in Settings to Always Right AirPod. The app then captures that Bluetooth microphone and routes the signal into the left output channel. Using AVAudioSession and AVAudioEngine we have successfully achieved low latency cross ear audio. The main issue is native AirPods Transparency. When the app activates the AirPods Bluetooth microphone using HFP, the transferred audio continues working correctly, but native Transparency audio on the receiving AirPod effectively disappears. Interestingly, iOS still reports Transparency as enabled in Control Center and AirPods settings. This means the user can hear audio transferred from the poor hearing side, but their working ear loses much of the normal environmental sound that Transparency previously provided. We have tested several configurations. Normal Bluetooth HFP with playAndRecord This provides the best result so far. The AirPods microphone signal is strong. The output route exposes two channels. We can route the microphone signal only to the opposite AirPod. Latency can be reduced enough that conversation feels nearly real time. However, native Transparency on the receiving AirPod effectively stops providing environmental audio. bluetoothHighQualityRecording Microphone quality is noticeably better. However, latency is significantly higher and produces an audible delayed or echo effect during conversation. Transparency has the same general issue. multiRoute with dualRoute This allows the iPhone audio hardware and AirPods to operate simultaneously. It appears to preserve more ambient awareness on the working side. However, the AirPods microphone becomes substantially weaker when used as the secondary Bluetooth HFP input. We measured the incoming AirPods microphone signal at roughly minus 40 dB during normal speech testing. Adding 12 to 18 dB of software gain increases distortion without materially improving intelligibility. farFieldInput with dualRoute We tested the raw AirPods microphone with and without farFieldInput. The microphone levels and practical pickup were very similar. Far field speech processing improved intelligibility somewhat, but did not solve the weak secondary Bluetooth input signal. Our main technical question is Is there a supported AVAudioSession configuration, Core Audio API, AirPods API, or entitlement that allows a third party application to capture an AirPods microphone while preserving the AirPods native Transparency processing on the output AirPod? Ideally we want Right AirPod microphone capture plus native Transparency on the left AirPod plus application generated right to left audio mixed into the left AirPod all operating simultaneously. We do not need access to Apple's Transparency microphone signal itself if native Transparency can simply remain active while our application audio is mixed into the receiving AirPod. If this is not currently possible using public APIs, is this an intentional platform limitation of the AirPods Bluetooth microphone route? We would also appreciate guidance on whether there is another recommended architecture for this accessibility use case. The low latency cross ear routing itself works surprisingly well. Preserving natural environmental audio in the user's working ear while the Bluetooth microphone is active is currently the main technical blocker. Testing has been performed on a physical iPhone running iOS 26.x using Xcode 26.6 and current AirPods hardware, not the Simulator. Thank you for any guidance.
0
0
239
Aug ’26
watchOS: Network framework WebSocket loses its path ~35 s in, while URLSession keeps working
Following up on TN3135 and the resolution in https://developer.apple.com/forums/thread/773362 — that thread solved establishing a low-level connection on watchOS (the asynchronous AVAudioSession.activate(options:completionHandler:) instead of the synchronous setActive()). This question is about a connection staying established, which I could not find discussed anywhere. Environment: Apple Watch, watchOS 26.6 (23U67). Audio app, WKBackgroundModes = ["self-care"]. Real device, TestFlight build, not the simulator. What works Opening an NWConnection WebSocket to my own server is reliable — 8 attempts out of 8 reached .ready in 0.28–0.98 s, and an echo frame round-tripped in 27–89 ms. Interestingly, in my measurements it opens under BOTH activation variants: the asynchronous activate(options:completionHandler:) AND the synchronous setActive(true). The two are within ~0.2 s of each other. I mention it only because the thread above concluded the synchronous one is insufficient; on 26.6 I cannot reproduce that difference for establishment. What fails The connection goes quiet after roughly half a minute, and an NWPathMonitor running alongside it shows why: the path transitions to .unsatisfied. Four runs: +34.0 s (cellular) +34.6 s (cellular) +36.0 s (Wi-Fi) +34.3 s (companion link only — availableInterfaces ["other", "other"]) The server sends a heartbeat frame every 5 s and closes the socket on a schedule, so I can tell "the peer closed" from "we stopped receiving". The client receives beats 1–6 (5 s … 30 s) and then nothing; the scheduled close never arrives. What I ruled out Server side. The same client construction run on macOS against the same endpoint receives all 8 heartbeats and the scheduled close at 45.1 s. Both audio-session activation variants — no difference, as above. Network type — cellular, Wi-Fi and companion-link-only all drop at ~35 s. The app being suspended. The app keeps logging densely throughout, and in the last run it held a WKExtendedRuntimeSession (delegate reported extendedRuntimeSessionDidStart) and was actively playing audio through AVAudioEngine from the first second — i.e. the audio-streaming condition TN3135 describes — for the entire window. The path dropped anyway, at +34.3 s. An idle socket. Server traffic arrives every 5 s until the drop. The comparison that puzzles me The same app, on the same watch, the same afternoon, relays the same realtime audio session over plain HTTPS (URLSession) instead — and that runs for 64 s continuously without a stall, including straight through a WatchConnectivity "reachability settled: unreachable" transition. So a high-level URLSession request stream survives a period in which a low-level NWConnection's path is reported unsatisfied. That is consistent with the note in thread 773362 that "on watchOS every session is kinda like a background session, where the actual work is done out of process" — but it leaves me unsure what the intended behaviour is. Questions Is a ~35 s path lifetime the expected behaviour for low-level networking on watchOS, or does it indicate something wrong on my side? Does the TN3135 audio-streaming exception cover only the establishment of a low-level connection, or is it also supposed to keep the path available for the duration of the audio streaming? If it is supposed to persist: is there something beyond an active audio session, flowing audio and a WKExtendedRuntimeSession that an app must do to keep the path alive? If ~35 s is the expected ceiling, is a WebSocket a supported transport for a multi-minute conversational audio session on watchOS at all — or is relaying over URLSession the intended approach despite the guidance to prefer Network framework? Happy to file a bug with a sysdiagnose and a reduced sample project if that is more useful — please say the word and I will attach the numbers above.
4
0
1.5k
Aug ’26
audiomxd terminated for memory limit during short audio playback with background music
Hello, I need guidance on diagnosing an intermittent audio failure on an iPhone 12 running iOS 26.6.2. My app, Timer Workout Fitness, plays short bundled MP3 voice recordings for countdowns, repetition numbers and workout announcements. It uses React Native / Expo SDK 57 and expo-audio. The native playback implementation uses AVQueuePlayer, AVPlayerItem and AVURLAsset. Users can listen to Spotify while the app plays spoken cues, with ducking of the background music. Observed behavior: Playback can work correctly for an entire workout. Audio sometimes fails after background/foreground transitions, pausing Spotify, or completing one workout and starting another. The exact sequence is not consistently reproducible. The app may remain navigable while recorded audio becomes unavailable. Force-quitting does not always restore reliable playback. Restarting the iPhone has restored it in our tests. Speech-based voices have generally behaved more reliably before the failure. Evidence from a device Console capture: At 15:03:35 on October 12, the kernel reported termination of audiomxd with reason "per-process-limit" and a recorded footprint of 66866 KB. ReportSystemMemory confirmed the jetsam termination. Shortly before this, the Console contained AudioConverter construction messages associated with our app through mediaplaybackd. Our app subsequently reported media-services loss/reset and errors including: "Server was dead" OSStatus 1836282486 We have not established whether our playback implementation causes an accumulation of native resources, a temporary peak, or another issue. We do not assume that this is an iOS defect. The implementation originally retained up to 56 players for individual recordings and loaded them concurrently. We recently changed it to load only the recordings required by a workout: 15 players for 10 repetitions and 35 for 30 repetitions. Failures have still occurred in development testing, but we have not measured the corresponding native memory footprint. We also have a custom native patch affecting activation/deactivation and handling of media-services loss/reset. Current Expo Go tests do not include that patch; our TestFlight builds do. We can provide the patch for review. What is the recommended way to: Attribute audiomxd memory usage to our app’s playback resources? Verify that AVQueuePlayer items and associated decoding resources are released? Capture useful diagnostics for this service termination? Choose an appropriate playback architecture for frequent short local voice clips alongside background music? We have device Console logs and application diagnostic traces. We do not yet have a minimal native Xcode reproduction project and would appreciate guidance on what it should include.
Replies
0
Boosts
0
Views
24
Activity
7h
Issues with AVRoutePickerView channel switching
We are developing a voice call application that uses AVRoutePickerView, allowing users to switch between an iPhone, a speaker, and Bluetooth earphones. However, we have encountered an intermittent issue: when switching from the speaker to Bluetooth earphones, the earphones remain in a loading state, and the audio channel subsequently switches back to the speaker. How can we resolve this issue? Here is the sample code: let session = AVAudioSession.sharedInstance() do { try session.setCategory(.playAndRecord, mode: .default, options: [.allowBluetooth]) try session.overrideOutputAudioPort(isBluetoothConnected ? .none : .speaker) try session.setPreferredSampleRate(48000) try session.setPreferredIOBufferDuration(0.02) try session.setActive(true, options: []) INFO(" >>> start: hasBluetooth=\(isBluetoothConnected), inputs: \(session.currentRoute.inputs.map { $0.portType }) outputs: \(session.currentRoute.outputs.map { $0.portType })") } catch { ERROR("(error.localizedDescription)") }
Replies
5
Boosts
0
Views
1.8k
Activity
3d
AVSpeechSynthesizer audio pauses when the device locks, despite an active background AVAudioSession
My App announces a place name aloud via AVSpeechSynthesizer (through expo-speech) while a background location task detects the user has entered a new town. This works correctly in the foreground. In the background, with the device screen locked, speech that has already started reliably pauses mid-utterance the moment the screen locks, and resumes and completes the moment the screen is unlocked — even though: The app has UIBackgroundModes: ['audio', 'location'] declared. A genuinely active, native-confirmed AVAudioSession is already running continuously in the background (a looping AVAudioPlayer via expo-audio, separate from the speech itself). AVSpeechSynthesizer.usesApplicationAudioSession is at its default (true), so the synthesizer shares that same active session rather than managing its own. This is not a crash, and AVSpeechSynthesizer never reports onError, the utterance simply stalls and then continues later, which looks exactly like a pause/resume cycle tied to the screen lock event itself rather than any audio session interruption we can detect. What is implemented app.config.js declares the audio and location background modes, and expo-audio's config plugin with enableBackgroundPlayback: true. At app launch, expo-audio's setAudioModeAsync is called once with: { playsInSilentMode: true, shouldPlayInBackground: true, interruptionMode: 'duckOthers' } (We also tested interruptionMode: 'doNotMix' see below.) For the duration of a tracked journey, a silent/near-silent AVAudioPlayer-backed loop is started via expo-audio's createAudioPlayer(), specifically so the app has genuine continuous audio output (not just a configured session) for the whole background session. The player is also registered as the active Now Playing session via setActiveForLockScreen() (expo-audio's wrapper around MPNowPlayingInfoCenter / MPRemoteCommandCenter). When a new place is detected (from a background expo-location task), we call Speech.speak() with the place name. onStart, onDone, onStopped, and onError callbacks are all logged for diagnostics. 5. We listen to the player's native playbackStatusUpdate event to know, from real OS-reported status (not just "the .play() call didn't throw"), whether the keep-alive loop is actually playing. Observed behavior: field test evidence Device log example (stationary repeated test): 08:29:01.948 onStart 08:29:02.092 keep-alive loop confirmed playing (native status) 08:29:07.666 onDone That's a 5.7s onStart-to-onDone gap for a phrase that normally takes under 2s — consistent with the utterance pausing mid-speech when the screen locked, then resuming on unlock. A separate test that stayed unlocked completed the same kind of phrase in 1.9s. On a real 68-minute drive, locked cycles showed 9.4-12.5s gaps; some builds with more aggressive session-reactivation never completed at all (onStart with no onDone/onStopped/onError). Throughout, the background AVAudioPlayer loop's native status still reports playing: true, and Control Center shows the app as Now Playing. So the AVAudioSession is confirmably alive — only the speech utterance itself stalls on lock. What we've ruled out: usesApplicationAudioSession already defaults to true (confirmed via WWDC 2020 session 10022), the synthesizer already shares our configured session, this isn't a missing option. Tried both doNotMix and duckOthers interruption modes. Neither stops the pause-on-lock. duckOthers additionally stops the app showing as Now Playing in Control Center (doNotMix does show it). Keep-alive liveness: native playback status confirms the background AVAudioPlayer reaches playing: true within 100-800ms every time — the session itself isn't failing to activate. We can't observe AVAudioSessionInterruptionNotification directly from our React Native audio libraries, only each library's own polled status — so we can't confirm whether a real interruption notification fires at the moment of lock. That's one of our questions below. Questions: Is it expected that AVSpeechSynthesizer, with usesApplicationAudioSession=true and an already-active background AVAudioSession (.playback category, UIBackgroundModes including audio), still pauses an in-progress utterance when the screen locks and resumes on unlock? If so, is there a supported way to prevent that for a navigation/voice-prompt app? Does locking the screen alone generate an AVAudioSessionInterruptionNotification for an app in this configuration, and if so what interruption type is reported? We can't observe this through our current libraries and want to know what native behavior to expect. Apple's "Audio Guidelines By App Type" doc gives two sets of guidance that both partly apply to us: navigation apps (activate the session only when a prompt is needed, deactivate after, use duckOthers) vs. playback apps (don't stream silence to avoid suspension, use a background task instead). Is there a recommended pattern for an app needing short, infrequent spoken prompts to continue through a locked screen, triggered by a background location task rather than continuous media playback?
Replies
0
Boosts
0
Views
312
Activity
1w
UX pain point - iOS - Stopping foreground apps from cutting audio - Neurodivergent users
TL;DR Requesting a system-level iOS feature or API to prioritize background audio over foreground app interruptions for enhanced neurodivergent accessibility. Granular Audio Session Priority and Control Center Override For users who rely on parallel cognitive processing - such as neurodivergent individuals managing attention through sensory layering like jumping across apps - abrupt audio interruptions are deeply disruptive. One scenario - a user is deep in cognitive flow listening to audio via Apple Music. They then switch to Instagram to check a text or post as natural neurodivergent attention switching and a video automatically fires up audio and instantly cuts the track playing on Apple Music. Regaining the audio stream requires manual intervention and therefore a breaking of focus. Proposal - I would love and suggest a native iOS feature or Control Center overlay allowing users to define audio hierarchy across apps, e.g. by locking background media as primary; open for ideas of course. This may as well be useful in therapeutical setups to easily silence potential notifications of lower priority over audio media designed to sensorically set guidelines for a session. Scope - while potentially helpful to users in the audio engineering and music playing scene running third-party-apps like Ableton and such, the feature request is intended to assist a basic and non-teh-savvy iOS user. Technical Question - is there any undocumented or upcoming capability within ⁠AVAudioSession⁠ categories/modes that could allow a developer to gracefully intercept or suppress automatic audio ducking/interruption from third-party foreground apps? PS First post. Nothing similar found on the forum. Nice request. Would love feedback or a technical review on feasibility.
Replies
0
Boosts
0
Views
292
Activity
1w
watchOS 27 TTS/Bluetooth Issue
When playing TTS on a watchOS 27 device while AirPods or a Bluetooth headset are connected to both the Apple Watch and the iPhone: Playback begins by calling the setActive function of AVAudioSession. A successful response is received, but... ...AVAudioSession.currentRoute.outputs lists only the built-in speaker, with no entry for the Bluetooth headset or earphones. After a brief delay, an AVAudioSession.routeChangeNotification is received, and playback then switches to the AirPods. If TTS is stopped and playback is attempted again: Playback frequently fails. In this state, AVAudioSession.currentRoute.outputs still shows no Bluetooth headset or earphones. However, checking the Bluetooth settings on the Apple Watch confirms that the AirPods or Bluetooth headset are properly connected. If the app is restarted—or if you exit and re-enter the TTS playback screen—the first attempt succeeds (albeit with a delay), but subsequent attempts after stopping fail. Sometimes, playback fails right from the start. Even in this case, the AirPods remain properly connected. The issue is resolved if the AirPods are disconnected from the iPhone and connected solely to the Apple Watch. When connected only to the watch, AVAudioSession.currentRoute.outputs correctly includes the Bluetooth headset or earphones from the start, and playback issues do not occur when repeatedly stopping and restarting. Playback worked fine with simultaneous Bluetooth connections up to watchOS 26, but a strange issue has started occurring since watchOS 27. We suspect this is a bug or error introduced in watchOS 27; could you please fix it? The same issue persists even after the recent update to version 27.0.1. Alternatively, please let us know if there is a way to resolve this within the app itself. It seems impossible to fix this in the current code because there is no way to programmatically trigger a popup on the Apple Watch that forces the selection of a currently connected Bluetooth headset or AirPods. Also, it does not appear to be an issue with the TTS API.
Replies
0
Boosts
0
Views
356
Activity
1w
iPad (9th gen) headphone output ~2.5 to 4.5 dB quieter on iPadOS 27 (FB24980117)
Since iPadOS 27, the 3.5 mm headphone output on iPad (9th generation) is 2.4 to 4.5 dB quieter than on iPadOS 26, depending on frequency, with the same content, system volume and headphones. It's still present in iPadOS 27.2 beta 2 (24B5089g). It isn't app-specific. It reproduces in Safari: Connect wired headphones to the 3.5 mm jack and set system volume to 100%. Open https://www.szynalski.com/tone-generator/, set 3000 Hz, set the generator volume to 50%, and play. Measure with a sound level meter. At 3 kHz we see 2.5 to 2.9 dB less on iPadOS 27 than on iPadOS 26, across three different headphone models. Audio settings are identical between the two OS versions and Bluetooth is off. The only session-level difference we found is AVAudioSession.outputLatency, which went from 97 to 65 frames. Filed as FB24980117.
Replies
0
Boosts
0
Views
389
Activity
2w
Sometimes CallKit doesn't send back audioSession didActivate
I'm having problem with my VoIP application. My app uses Callkit and VoIP push notification to make SIP calls between same app. Sometimes after taking the phone the call doesn't start. I found out iOS is not sending back audioSession didActive response to my app. Is this known issue or bug?
Replies
1
Boosts
0
Views
394
Activity
3w
CallKit does not activate audio session with higher probability after upgrading to iOS 18.4.1
Hi, We've noticed that this issue occurs more frequently after upgrading to iOS 18.4.1 and can result in one-way audio. Our app uses CallKit with WebRTC to establish VoIP connections. However, on iOS 18.4.1, CallKit no longer triggers: func provider(_ provider: CXProvider, didActivate audioSession: AVAudioSession) We're currently comparing the occurrence rate across different iOS versions to better understand the impact. Could you please help analyze the root cause of this issue?
Replies
40
Boosts
1
Views
5.3k
Activity
3w
Low-latency, high-quality audio route w/wireless CarPlay?
Is there a supported way for a CarPlay audio app to request a lower-latency wireless playback route without communications-style audio processing or restricted volume behavior? .playback + .default on wired CarPlay gets you ~60ms latency route. The same on wireless CarPlay gets you ~1100ms latency. I know that wireless CarPlay can support faster connections as I have tested them. playAndRecord + .default and .playback + .voicePrompt negotiate approximately 160 ms output/presentation latency. However, on this head unit those paths have unacceptable side effects: The duplex route negotiates 24 kHz mono and removes or severely attenuates bass/haptic-engine content. The voice-prompt route alters volume semantics: steering-wheel/head-unit volume does not control our app’s level, and it appears to apply voice-oriented EQ or other processing. These routes therefore cannot substitute for full-bandwidth media playback, even though their latency is much better. 24 kHz mono would actually work for our app, if only it preserved the signal without voice/telephony EQ, bass removal, or special prompt-bus volume policy. Is there a documented, supported public API or AVAudioSession configuration (or other API even) that lets a CarPlay audio app request that kind of low-latency wireless media route? If not, is this an intentional limitation of wireless CarPlay media playback, and is there an appropriate enhancement-request path for real-time audio applications?
Replies
0
Boosts
0
Views
316
Activity
4w
Does the TN3135 audio-session networking exception have a defined lifetime? Seeing a ~38.5 s revoke/re-grant cycle
TN3135 describes the exception that lets a watchOS app use low-level networking while it holds an active audio session. I have that working, and the app functions — but the network path is withdrawn and restored on a strikingly regular cycle, and I would like to know whether that is expected behaviour rather than something I am doing wrong. Setup Apple Watch Series 10 (Watch7,9), watchOS 26.5. Reproduced on a Series 6 (Watch6,2). UIBackgroundModes: [audio]; AVAudioSession category .playAndRecord, mode .spokenAudio; activated with the async activate(options:completionHandler:). NWConnection with NWProtocolWebSocket to a WebSocket relay over TLS. The app streams 16 kHz mono PCM continuously while transmitting and holds the socket open otherwise. Symptom NWPathMonitor reports .unsatisfied, then .satisfied about two seconds later, over and over. Measured with the iPhone powered off, so the watch was on its own Wi-Fi: Uptime between drops Outage 36.4 s 2.1 s 36.7 s 1.9 s 36.9 s 2.1 s The regularity is what prompts the question — uptime varies by ±0.3 s and the outage is consistently 2.0 s. That reads as a timeout expiring rather than radio behaviour. What I have ruled out Not the network or the server. A browser client on the same relay, same TLS, same wire protocol, holds a WebSocket indefinitely. Not the interface. Identical cadence over the companion ipsec1 tunnel with the iPhone present, and over the watch's own en0 with the iPhone powered off. Pinning requiredInterfaceType = .wifi while the iPhone is reachable fails outright — the path offers only ipsec1. Not audio-session interruption. I observe interruptionNotification, routeChangeNotification, mediaServicesWereResetNotification and silenceSecondaryAudioHintNotification. None fire at a drop. At the moment the path goes .unsatisfied, the engine is running and the player node is actively playing. Not session idleness. Playing continuous silence for the whole session, rather than only while reconnecting, made no difference — still 36.4 s. The control that surprised me To test whether this affects any long-lived watch socket or only audio-unlocked ones, I built a second app with no AVAudioSession at all, no audio background mode, holding a URLSessionWebSocketTask and kept alive by a WKExtendedRuntimeSession so screen sleep was not a factor. It never connected. NWPathMonitor reported .unsatisfied once and never changed, across a 30 s run, and every request failed with "The Internet connection appears to be offline." I had expected URLSession to be permitted regardless. Questions Does the audio-session networking exception in TN3135 have a defined lifetime, and is a periodic revoke/re-grant cycle expected? If so, is there a supported way to hold it continuously — or is the correct design simply to expect the interruption and reconnect through it? Is it expected that an app with no audio session gets no network path at all on watchOS, including via URLSession, even in the foreground with an extended runtime session?
Replies
16
Boosts
0
Views
3.8k
Activity
Sep ’26
AirPods Sleep Detection pauses meditation playback with no API/callback to identify the reason
Good morning! I work on a meditation app, and since Sleep Detection was introduced for AirPods in iOS 26, we've been receiving complaints from users reporting that their meditation sessions unexpectedly stop after approximately 15–20 minutes when Sleep Detection is enabled. This seems to happen particularly during deep meditation sessions, where the user may remain still and exhibit behavior that could potentially be interpreted as falling asleep. I've also tested this on iOS 27 with the latest beta firmware available for AirPods Pro, and the same behavior still occurs. While investigating and debugging the issue, I found that there doesn't appear to be any public API that allows an app to determine that playback was paused specifically because of AirPods Sleep Detection. From the application's perspective, the AirPods appear to simply send a standard pause command to the AVPlayer, without providing any additional context or reason. There also doesn't seem to be an API that allows us to determine whether the user has Sleep Detection enabled. Even having access to that information would allow us to warn users that their meditation session could potentially be interrupted. AVAudioSession.InterruptionReason does not seem to help in this case either: https://developer.apple.com/documentation/avfaudio/avaudiosession/interruptionreason Is there currently any supported way for an app to: Detect that playback was paused specifically because of AirPods Sleep Detection? Determine whether Sleep Detection is enabled for the connected AirPods? Prevent Sleep Detection from pausing playback for specific apps or specific types of audio sessions? If none of these are currently possible, could Apple consider providing either a notification/callback indicating that Sleep Detection triggered the pause, or an option for users to exclude specific apps from Sleep Detection? This behavior is particularly problematic for meditation apps, since a user in a deep meditation session can easily be mistaken for someone who has fallen asleep. Other meditation apps appear to be affected by the same behavior as well. Best regards, Carlos Antunes
Replies
1
Boosts
0
Views
1.2k
Activity
Sep ’26
Can an iOS app programmatically enable Voice Isolation microphone mode?
Hi, I’m developing an iOS app that captures the user’s voice and sends the microphone input to an AI model for speech processing. For this use case, Voice Isolation provides a significantly better input signal in noisy environments. However, I’m currently unable to enable Voice Isolation programmatically when the app starts recording. As I understand it, microphone modes such as Automatic, Standard, Voice Isolation, and Wide Spectrum are controlled by the user through the system UI. My app can detect/observe the current microphone mode, but I have not found a public API that allows the app to select Voice Isolation itself. My questions are: Is there currently a supported public API to programmatically switch the microphone mode from Automatic/Standard → Voice Isolation? If direct selection is not supported, is there a recommended way for an app that primarily processes speech/voice input for an AI model to request or prefer Voice Isolation? Would using AVAudioSession with an appropriate voice-processing configuration, such as .voiceChat, or enabling voice processing through AVAudioEngine, provide equivalent Voice Isolation processing? Is AVCaptureDevice.showSystemUserInterface(.microphoneModes) the intended approach when an app needs the user to change the microphone mode? I understand that Apple may intentionally keep microphone-mode selection under user control. I’m mainly trying to determine whether there is a supported programmatic approach that I may have overlooked, rather than relying on a custom noise-suppression implementation. Any guidance on the recommended architecture for this use case would be greatly appreciated. Thank you!
Replies
0
Boosts
0
Views
621
Activity
Sep ’26
PushToTalk session sometimes returns silence data after activation
Hello! Thank you for bringing the new iPhone experience with the PushToTalk framework. I have a working walkie talkie app based on the PushToTalk framework. Everything works fine except for an intermittent bug that I face from time to time on different devices with different iOS versions, from iOS 18 to iOS 26.2 Beta. Sometimes the app goes into a state where the AVAudioInputNode input node tap returns buffers with a constant size that contain only silence. Leaving and rejoining a channel helps, but relaunching or reinstalling (from Xcode) the app does not. Rebooting the device or deleting and reinstalling the app also helps. I do not activate the audio session in my app. I only configure it on launch using setCategory(.playAndRecord, options: [.defaultToSpeaker, .allowBluetooth]) So the flow is: channelManager?.requestBeginTransmitting(channelUUID: globalChannelUUID) func channelManager( _ channelManager: PTChannelManager, channelUUID: UUID, didBeginTransmittingFrom source: PTChannelTransmitRequestSource ) func channelManager( _ channelManager: PTChannelManager, didActivate audioSession: AVAudioSession ) { /// ... installTapAndStart() } private func installTapAndStart() { let inputNode = audioEngine.inputNode let hardwareFormat = inputNode.outputFormat(forBus: 0) guard let targetFormat = AVAudioFormat( commonFormat: .pcmFormatFloat32, sampleRate: configuration.audioSampleRate, channels: configuration.audioChannelsCount, interleaved: true ) else { handleError(RecorderError.invalidAudioFormat) return } let converter = AVAudioConverter(from: hardwareFormat, to: targetFormat)! print("[QUICOpusRecorder]: installTap") inputNode.installTap(onBus: 0, bufferSize: tapBufferSize, format: hardwareFormat) { [weak self] buffer, _ in guard let self else { return } // Here I handle audio data and sometimes get silence } //... do { audioEngine.prepare() try audioEngine.start() } catch { print(" ⚠️ Audio engine start error: \(error)") handleError(error) } } Moreover, if the app is in the foreground and PushToTalk gets stuck in this “silence bug”, I can avoid relying on the PushToTalk flow and simulate audio session activation manually in code. In this case I do not request a transmission and do not use any PushToTalk related code, and the app captures audio data perfectly. Once I leave the channel and rejoin it again, the issue is fixed and I start to receive non silent buffers of varying size, as expected. It works for a while. It can work fine for a day or more, communicating without launching the app, or with the app in the foreground. But it can also go into the “silence” state 30 minutes after working normally. I have no clue why this happens. The only thing I notice is that when the app is in this “stuck silence bug” state, iOS does not play its “chirp” system sound when audio recording starts. P.S. Channel descriptor restoration code: extension PushToTalkEngine: PTChannelRestorationDelegate { public func channelDescriptor(restoredChannelUUID channelUUID: UUID) -> PTChannelDescriptor { print("☀️ \(#function) channelUUID: \(channelUUID)") Task { @MainActor in // Here I fetch more detailed channel data asynchronously do { await initChannelManagerIfNeeded(channelUUID: channelUUID) let channelDescriptor = currentChannelDescriptor() lastChannelDescriptorName = channelDescriptor.name try await channelManager?.setChannelDescriptor( channelDescriptor, channelUUID: channelUUID ) } catch { handleError(error) } } return PTChannelDescriptor(name: "Loading...", image: nil) } } private func initChannelManagerIfNeeded(channelUUID: UUID? = nil) async { guard let channelUUID = channelUUID ?? currentUser?.globalChannelUUID else { print("❌ No global channel uuid found") return } do { guard channelManager == nil else { try await channelManager?.setTransmissionMode(.halfDuplex, channelUUID: channelUUID) return } channelManager = try await PTChannelManager.channelManager( delegate: self, restorationDelegate: self ) try await channelManager?.setTransmissionMode(.halfDuplex, channelUUID: channelUUID) } catch { handleError(error) } }
Replies
4
Boosts
0
Views
1.5k
Activity
Aug ’26
provider(_:didActivate:) callback intermittently not triggered, causing widespread audio loss for users
Hi everyone, I am facing a critical issue where the CallKit provider delegate method provider(_:didActivate:) is intermittently not triggered. This occasionally results in a total loss of audio during some VoIP calls, while other calls work perfectly fine. Here is the sequence of steps I am currently implementing: Report Incoming Call: The app receives a VoIP push notification and reports the call using reportNewIncomingCall(with:update:completion:). Answer Action: The user taps the answer button, and the app processes the CXAnswerCallAction. Configure Audio Session: Inside the provider delegate, I configure the AVAudioSession category and mode (e.g., setting category to .playAndRecord and mode to .voiceChat). Note: As per Apple's guidelines, I do not call setActive(true) manually, expecting CallKit to activate it automatically. Despite following this standard flow, there are times when provider(_:didActivate:) is skipped entirely, meaning the audio engine fails to initialize for that specific call session. We are currently receiving a large volume of user complaints regarding this issue, as it heavily impacts the core calling experience in production. Could an Apple engineer or anyone from the community look into this? Any insights into what might be causing CallKit to occasionally fail to activate the audio session or how to work around this would be highly appreciated. Thank you!
Replies
5
Boosts
0
Views
1.2k
Activity
Aug ’26
Preserve AirPods Transparency while capturing one AirPod microphone for low latency cross ear audio
I am prototyping an iOS accessibility audio application for people with unilateral hearing loss. The goal is simple. Capture environmental audio using the AirPod on the poor hearing side and route that audio with very low latency into the AirPod on the working hearing side. The core concept is already working on physical AirPods and an iPhone. Our desired signal path is Right AirPod microphone → iPhone audio processing → Left AirPod output The user sets the AirPods microphone in Settings to Always Right AirPod. The app then captures that Bluetooth microphone and routes the signal into the left output channel. Using AVAudioSession and AVAudioEngine we have successfully achieved low latency cross ear audio. The main issue is native AirPods Transparency. When the app activates the AirPods Bluetooth microphone using HFP, the transferred audio continues working correctly, but native Transparency audio on the receiving AirPod effectively disappears. Interestingly, iOS still reports Transparency as enabled in Control Center and AirPods settings. This means the user can hear audio transferred from the poor hearing side, but their working ear loses much of the normal environmental sound that Transparency previously provided. We have tested several configurations. Normal Bluetooth HFP with playAndRecord This provides the best result so far. The AirPods microphone signal is strong. The output route exposes two channels. We can route the microphone signal only to the opposite AirPod. Latency can be reduced enough that conversation feels nearly real time. However, native Transparency on the receiving AirPod effectively stops providing environmental audio. bluetoothHighQualityRecording Microphone quality is noticeably better. However, latency is significantly higher and produces an audible delayed or echo effect during conversation. Transparency has the same general issue. multiRoute with dualRoute This allows the iPhone audio hardware and AirPods to operate simultaneously. It appears to preserve more ambient awareness on the working side. However, the AirPods microphone becomes substantially weaker when used as the secondary Bluetooth HFP input. We measured the incoming AirPods microphone signal at roughly minus 40 dB during normal speech testing. Adding 12 to 18 dB of software gain increases distortion without materially improving intelligibility. farFieldInput with dualRoute We tested the raw AirPods microphone with and without farFieldInput. The microphone levels and practical pickup were very similar. Far field speech processing improved intelligibility somewhat, but did not solve the weak secondary Bluetooth input signal. Our main technical question is Is there a supported AVAudioSession configuration, Core Audio API, AirPods API, or entitlement that allows a third party application to capture an AirPods microphone while preserving the AirPods native Transparency processing on the output AirPod? Ideally we want Right AirPod microphone capture plus native Transparency on the left AirPod plus application generated right to left audio mixed into the left AirPod all operating simultaneously. We do not need access to Apple's Transparency microphone signal itself if native Transparency can simply remain active while our application audio is mixed into the receiving AirPod. If this is not currently possible using public APIs, is this an intentional platform limitation of the AirPods Bluetooth microphone route? We would also appreciate guidance on whether there is another recommended architecture for this accessibility use case. The low latency cross ear routing itself works surprisingly well. Preserving natural environmental audio in the user's working ear while the Bluetooth microphone is active is currently the main technical blocker. Testing has been performed on a physical iPhone running iOS 26.x using Xcode 26.6 and current AirPods hardware, not the Simulator. Thank you for any guidance.
Replies
0
Boosts
0
Views
239
Activity
Aug ’26
watchOS: Network framework WebSocket loses its path ~35 s in, while URLSession keeps working
Following up on TN3135 and the resolution in https://developer.apple.com/forums/thread/773362 — that thread solved establishing a low-level connection on watchOS (the asynchronous AVAudioSession.activate(options:completionHandler:) instead of the synchronous setActive()). This question is about a connection staying established, which I could not find discussed anywhere. Environment: Apple Watch, watchOS 26.6 (23U67). Audio app, WKBackgroundModes = ["self-care"]. Real device, TestFlight build, not the simulator. What works Opening an NWConnection WebSocket to my own server is reliable — 8 attempts out of 8 reached .ready in 0.28–0.98 s, and an echo frame round-tripped in 27–89 ms. Interestingly, in my measurements it opens under BOTH activation variants: the asynchronous activate(options:completionHandler:) AND the synchronous setActive(true). The two are within ~0.2 s of each other. I mention it only because the thread above concluded the synchronous one is insufficient; on 26.6 I cannot reproduce that difference for establishment. What fails The connection goes quiet after roughly half a minute, and an NWPathMonitor running alongside it shows why: the path transitions to .unsatisfied. Four runs: +34.0 s (cellular) +34.6 s (cellular) +36.0 s (Wi-Fi) +34.3 s (companion link only — availableInterfaces ["other", "other"]) The server sends a heartbeat frame every 5 s and closes the socket on a schedule, so I can tell "the peer closed" from "we stopped receiving". The client receives beats 1–6 (5 s … 30 s) and then nothing; the scheduled close never arrives. What I ruled out Server side. The same client construction run on macOS against the same endpoint receives all 8 heartbeats and the scheduled close at 45.1 s. Both audio-session activation variants — no difference, as above. Network type — cellular, Wi-Fi and companion-link-only all drop at ~35 s. The app being suspended. The app keeps logging densely throughout, and in the last run it held a WKExtendedRuntimeSession (delegate reported extendedRuntimeSessionDidStart) and was actively playing audio through AVAudioEngine from the first second — i.e. the audio-streaming condition TN3135 describes — for the entire window. The path dropped anyway, at +34.3 s. An idle socket. Server traffic arrives every 5 s until the drop. The comparison that puzzles me The same app, on the same watch, the same afternoon, relays the same realtime audio session over plain HTTPS (URLSession) instead — and that runs for 64 s continuously without a stall, including straight through a WatchConnectivity "reachability settled: unreachable" transition. So a high-level URLSession request stream survives a period in which a low-level NWConnection's path is reported unsatisfied. That is consistent with the note in thread 773362 that "on watchOS every session is kinda like a background session, where the actual work is done out of process" — but it leaves me unsure what the intended behaviour is. Questions Is a ~35 s path lifetime the expected behaviour for low-level networking on watchOS, or does it indicate something wrong on my side? Does the TN3135 audio-streaming exception cover only the establishment of a low-level connection, or is it also supposed to keep the path available for the duration of the audio streaming? If it is supposed to persist: is there something beyond an active audio session, flowing audio and a WKExtendedRuntimeSession that an app must do to keep the path alive? If ~35 s is the expected ceiling, is a WebSocket a supported transport for a multi-minute conversational audio session on watchOS at all — or is relaying over URLSession the intended approach despite the guidance to prefer Network framework? Happy to file a bug with a sysdiagnose and a reduced sample project if that is more useful — please say the word and I will attach the numbers above.
Replies
4
Boosts
0
Views
1.5k
Activity
Aug ’26