Dive into the technical aspects of audio on your device, including codecs, format support, and customization options.

Audio Documentation

Posts under Audio subtopic

Post

Replies

Boosts

Views

Activity

BlietoothHFP to MFi hearingaids
Is it possible to port a bluetooth microphone (BluetoothHFP) to MFi hearing aids connected to an iPhone. When I try to do that the BluetoothHFP grabs input and output. When I pull the output away (BluetoothA2DP) it gives up the input.
5
0
142
2w
Voice Isolation Suggestions
We are working on a voice app that uses ASR/TTS on the backend and run into some difficulties in noisy environments. We have compiled the DeepFilterNet3 library into an XCFramework and are using that on the app, but it's sometimes a bit ambitious with trimming out noise and removes some of the voice. Is there any way to make use of Apple's on-device voice isolation mic mode? I see that we can detect the user's mic mode, but we cannot programmatically set it. While we could prompt the user to enable it manually, this adds a bit of friction to the user experience. Do you have any suggestions for enabling voice isolation, or for performing denoising in general?
1
0
93
2w
Acoustic Echo Cancellation doesn't initially work
We are using AEC in our voice app and it mostly works. However, when the experience begins we play a greeting through the speaker, and the initial few hundred milliseconds of the greeting are being captured by the inputNode. This is throwing off our ASR/TTS. For now, we've disabled audio capture while playing audio, but would prefer to be able to capture all audio with echo cancellation working. Below is some relevant code snippets. Do you have any suggestions to get AEC working more quickly? I've tried a few things like enabling voice processing before setting the audio session to active. public init() { recorderNode = engine.inputNode speakerNode = engine.outputNode mainMixerNode = engine.mainMixerNode engine.attach(audioPlayer) engine.connect( audioPlayer, to: mainMixerNode, format: nil ) playbackFormat = mainMixerNode.outputFormat(forBus: 0) } public func setupAudioSession() async throws(AudioError) { do { let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory( .playAndRecord, mode: .voiceChat, policy: .default, options: [ .defaultToSpeaker, .allowBluetoothHFP, ] ) try audioSession.setActive(true) } catch { throw .audioSessionSetupFailed(error) } do { try recorderNode.setVoiceProcessingEnabled(true) try speakerNode.setVoiceProcessingEnabled(true) } catch { throw .enableVoiceProcessingFailed(error) } }
1
0
76
2w
Acoustic Echo Cancellation does not work initially
I have a voice app that is both playing and recording audio. I have enabled voice processing and am setting AVAudioSession.Category to .playAndRecord and AVAudioSession.Mode to .voiceChat. When the experience first launches, we play a greeting. The first few hundred milliseconds of that greeting are being captured by the inputNode before AEC seems to start working. Is there any way to get AEC working the entire time? For now we've had to disable recording while we're playing audio, but would prefer to both play and record simultaneously. Here's some code snippets: public init(denoiseModelPath: URL? = nil) { noiseReducer = denoiseModelPath.flatMap { NoiseReducer(modelPath: $0) } recorderNode = engine.inputNode speakerNode = engine.outputNode mainMixerNode = engine.mainMixerNode engine.attach(audioPlayer) engine.connect( audioPlayer, to: mainMixerNode, format: nil ) playbackFormat = mainMixerNode.outputFormat(forBus: 0) } public func setupAudioSession() async throws(AudioError) { do { let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory( .playAndRecord, mode: .voiceChat, policy: .default, options: [ .defaultToSpeaker, .allowBluetoothHFP, ] ) try audioSession.setActive(true) } catch { throw .audioSessionSetupFailed(error) } do { try recorderNode.setVoiceProcessingEnabled(true) try speakerNode.setVoiceProcessingEnabled(true) } catch { throw .enableVoiceProcessingFailed(error) } }
1
0
73
2w
Voice Isolation Suggestions
We are working on a voice app that uses ASR/TTS on the backend and run into some difficulties in noisy environments. We have compiled the DeepFilterNet3 library into an XCFramework and are using that on the app, but it's sometimes a bit ambitious with trimming out noise and removes some of the voice. Is there any way to make use of Apple's on-device voice isolation mic mode? I see that we can detect the user's mic mode, but we cannot programmatically set it. While we could prompt the user to enable it manually, this adds a bit of friction to the user experience. Do you have any suggestions for enabling voice isolation, or for performing denoising in general?
2
0
115
2w
Live Activity sleep timer without push
My app has a sleep timer (up to 12 hours). Can I drive a Live Activity countdown in the Dynamic Island purely from the foreground/background app process using Activity.update(), without requiring a push notification server? And does Text(timerInterval:) in SwiftUI continue counting down accurately when the app process is suspended by the OS?
0
0
68
2w
Foundation Models for audio recommendation
Is it appropriate to use the Foundation Models framework on-device to power a natural language sound recommendation feature (e.g. user types 'I can't focus' → model returns a frequency/playlist recommendation from a predefined set)? Or is this use case better served by a custom Core ML model? What's the recommended on-device inference approach in iOS 27 for this type of structured recommendation with a small output space?
0
0
58
2w
App Intents for audio playback actions in iOS 27
With SiriKit deprecated in iOS 27, I'm implementing App Intents from scratch for a frequency/ambient sound app. Should I conform to AudioPlaybackIntent from the Media framework or build a custom AppIntent? Specifically, I need intents for: play a named frequency, start sleep timer with duration, stop playback. Is there a recommended Intent entity type for audio content that isn't music (i.e. not MusicKit-backed)?
0
0
65
2w
Does the OS has dedicated volume levels for each AVAudioSessionCategory.
We have an VoiP application, our application can be configured to amplify the PCM samples before feeding it to the Player to achieve volume gain at the receiver. In order to support this, We follow as below. If User has configured this Gain Settings within application, Application applies the amplification for the samples to introduce the gain. Application will also set the AVAudioSessionCategory to AVAudioSessionCategoryPlayback Provided the User has chosen the output to Speaker. This settings was working for us but we see there is a difference in behaviour w.r.t Volume Level System Settings between OS 26.3.1 and OS 26.4 When user has chosen earpiece as Output, then we will set the AVAudioSessionCategory to AVAudioSessionCategoryPlayAndRecord. User would have set the volume level to minimum. When user will change the output to Speaker, then we will set the AVAudioSessionCategory to AVAudioSessionCategoryPlayback. The expectation is, the volume level should be of AVAudioSessionCategoryPlayback what was set earlier instead we are seeing the volume level stays as minimum which was set to AVAudioSessionCategoryPlayAndRecord Could you please explain about this inconsistency w.r.t Volume level.
7
0
1.1k
2w
Visualization of Apple Music audio
Certain apps (eg. DJay) at least seem to have access to audio data from Apple Music streams, either directly or via an indirect dataset for visualization purposes either generated from audio data on the device or delivered from a remote service. Is there any framework provided by Apple or special agreement with Apple that gives access to Apple Music audio data, or sets of visualization meta data, or the ability to run processing of audio data on device or remotely (either on-demand or via preprocessing)?
0
1
92
2w
AUv3 "Failed to find component with type..." frequent issues
When the host app of a host/AUv3 extension pair tries to find the audio extension it fails. The system should have scanned the bundle for the extension, but this appears to fail. This basically happens in SimplePlayEngine.initComponent. I've seen this intermittent problem for years. There are many sometimes-effective workarounds that I've gathered and used, but the problem still exists. It is not a problem of validation -- the same AU can validate in some run cycles and then not be found via the host app in others. I've got a Feedback Assistant ticket for the latest iteration of the problem (FB22860885), which has affected beta testers. Usually I only see this when developing with Xcode myself. So even though the testers' app lives in ~/Applications it is still failing for some of them.
3
1
131
2w
WKWebView / MusicKit.js: Can buffered seeks void audio interruption during playback?
This question overlaps with a newer post that contains additional implementation details To avoid splitting discussion, please see: “MusicKit.js / WKWebView: Are audible hitches during seek a known WebKit or Apple Media Stack limitation?” We are building a music practice application that uses MusicKit.js inside a WKWebView on iOS and macOS. Our application requires tight musical looping, where playback repeatedly seeks back to a loop start position while a song is playing. We have observed that: • Seeking to a nearby position within already-buffered audio using HTMLAudioElement.currentTime causes an audible interruption or hitch. • Changing HTMLAudioElement.playbackRate during playback also appears to interrupt playback briefly. • These interruptions make seamless looping difficult to achieve. For comparison, a very similar JavaScript architecture running in a Chromium-based WebView on Android exhibits significantly smoother seek behavior and supports near-seamless looping. Our questions are: Is it expected that changing currentTime or playbackRate on the underlying audio element causes the playback pipeline to be interrupted or rebuilt on Apple platforms? Are there any recommended WebKit, WKWebView, or MusicKit.js techniques that can reduce or eliminate these interruptions when seeking within already-buffered media? Would native MusicKit playback provide lower-latency or more seamless seeking than MusicKit.js, or do both approaches ultimately rely on the same playback pipeline? Our use case is musical practice, where even interruptions of a few tens of milliseconds are noticeable. Any guidance on achieving the smoothest possible loop-seeking behavior on Apple platforms would be greatly appreciated.
0
1
80
2w
MusicUnderstanding and Apple Music / MusicKit
Certain apps (eg. DJay) seem to have direct or indirect access to the audio data from Apple Music, either on the device or remotely preprocessed. Is that feature available for other third party apps? Am I correct in my understanding that the new framework MusicUnderstanding (which looks quite interesting, judging from the docs so far) is not in any way usable for streams or local files from Apple Music / MusicKit since it relies entirely on AVReadOnlyAudioPCMBuffer? Is there eg. a way to get the same kind of music understanding data (or some other meta data suitable for real time visualization) provided directly form Apple Music without going via a readable audio buffer?
0
3
165
2w
Presentation mode
What's the best way of dealing with presentation mode (when the phone screen is captured by Google Meet or any other presenter software) when AudioSession is activated with .playAndRecord mode? The goal is to share the audio output between the phone and Google Meet so participants can hear it as well, while also enabling a microphone for future interactions within the app, for, let's say, voice chat.
0
0
28
2w
AVSpeechSynthesis voices
Up to iOS 18 there were many voices available on device by default including "Nicky" that I use in my app. Somewhere around iOS 18.6 or 26.0 these voices were removed and no longer included in the OS by default. This broke my app that counted on the Nicky voice being available. My only workaround is to direct my users to download the voice again by going to Accessibility > VoiceOver > Speech > Voices and downloading "Nicky". I cannot simply switch to using Samantha (the only voice that is still available by default) because I have heavily customized how IPA pronunciations are tweaked to make Nicky speak Old English correctly. I tried briefly with Samantha but the results were not as good. I have 2 questions: Is there any way for me to include the "Nicky" voice in my app or for me to trigger the download from the app so I don't have to show an error and direct users through the settings app to get the voice? Are there any new features with AI voices in iOS 27 that I can use with IPA pronunciations to get them to speak possibly better than the Nicky voice?
0
0
37
2w
Bluetooth mic in, live listen out
Is it possible to link a HFBluetooth input device with the output iPhone speaker while Live Listen is active?
Replies
10
Boosts
0
Views
389
Activity
2w
BlietoothHFP to MFi hearingaids
Is it possible to port a bluetooth microphone (BluetoothHFP) to MFi hearing aids connected to an iPhone. When I try to do that the BluetoothHFP grabs input and output. When I pull the output away (BluetoothA2DP) it gives up the input.
Replies
5
Boosts
0
Views
142
Activity
2w
Voice Isolation Suggestions
We are working on a voice app that uses ASR/TTS on the backend and run into some difficulties in noisy environments. We have compiled the DeepFilterNet3 library into an XCFramework and are using that on the app, but it's sometimes a bit ambitious with trimming out noise and removes some of the voice. Is there any way to make use of Apple's on-device voice isolation mic mode? I see that we can detect the user's mic mode, but we cannot programmatically set it. While we could prompt the user to enable it manually, this adds a bit of friction to the user experience. Do you have any suggestions for enabling voice isolation, or for performing denoising in general?
Replies
1
Boosts
0
Views
93
Activity
2w
Acoustic Echo Cancellation doesn't initially work
We are using AEC in our voice app and it mostly works. However, when the experience begins we play a greeting through the speaker, and the initial few hundred milliseconds of the greeting are being captured by the inputNode. This is throwing off our ASR/TTS. For now, we've disabled audio capture while playing audio, but would prefer to be able to capture all audio with echo cancellation working. Below is some relevant code snippets. Do you have any suggestions to get AEC working more quickly? I've tried a few things like enabling voice processing before setting the audio session to active. public init() { recorderNode = engine.inputNode speakerNode = engine.outputNode mainMixerNode = engine.mainMixerNode engine.attach(audioPlayer) engine.connect( audioPlayer, to: mainMixerNode, format: nil ) playbackFormat = mainMixerNode.outputFormat(forBus: 0) } public func setupAudioSession() async throws(AudioError) { do { let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory( .playAndRecord, mode: .voiceChat, policy: .default, options: [ .defaultToSpeaker, .allowBluetoothHFP, ] ) try audioSession.setActive(true) } catch { throw .audioSessionSetupFailed(error) } do { try recorderNode.setVoiceProcessingEnabled(true) try speakerNode.setVoiceProcessingEnabled(true) } catch { throw .enableVoiceProcessingFailed(error) } }
Replies
1
Boosts
0
Views
76
Activity
2w
MusicUnderstanding and Apple Music / MusicKit
Am I correct in my understanding that the new MusicUnderstanding is not intended to be able to support analysis of Apple Music streams via MusicKit or in other ways?
Replies
1
Boosts
0
Views
91
Activity
2w
iOS and macOS support of Bluetooth LC3
Do iOS and/or macOS support Bluetooth LC3? If yes, since what iOS/macOS version? is there any limitation and/or caveat?
Replies
2
Boosts
0
Views
61
Activity
2w
Acoustic Echo Cancellation does not work initially
I have a voice app that is both playing and recording audio. I have enabled voice processing and am setting AVAudioSession.Category to .playAndRecord and AVAudioSession.Mode to .voiceChat. When the experience first launches, we play a greeting. The first few hundred milliseconds of that greeting are being captured by the inputNode before AEC seems to start working. Is there any way to get AEC working the entire time? For now we've had to disable recording while we're playing audio, but would prefer to both play and record simultaneously. Here's some code snippets: public init(denoiseModelPath: URL? = nil) { noiseReducer = denoiseModelPath.flatMap { NoiseReducer(modelPath: $0) } recorderNode = engine.inputNode speakerNode = engine.outputNode mainMixerNode = engine.mainMixerNode engine.attach(audioPlayer) engine.connect( audioPlayer, to: mainMixerNode, format: nil ) playbackFormat = mainMixerNode.outputFormat(forBus: 0) } public func setupAudioSession() async throws(AudioError) { do { let audioSession = AVAudioSession.sharedInstance() try audioSession.setCategory( .playAndRecord, mode: .voiceChat, policy: .default, options: [ .defaultToSpeaker, .allowBluetoothHFP, ] ) try audioSession.setActive(true) } catch { throw .audioSessionSetupFailed(error) } do { try recorderNode.setVoiceProcessingEnabled(true) try speakerNode.setVoiceProcessingEnabled(true) } catch { throw .enableVoiceProcessingFailed(error) } }
Replies
1
Boosts
0
Views
73
Activity
2w
Voice Isolation Suggestions
We are working on a voice app that uses ASR/TTS on the backend and run into some difficulties in noisy environments. We have compiled the DeepFilterNet3 library into an XCFramework and are using that on the app, but it's sometimes a bit ambitious with trimming out noise and removes some of the voice. Is there any way to make use of Apple's on-device voice isolation mic mode? I see that we can detect the user's mic mode, but we cannot programmatically set it. While we could prompt the user to enable it manually, this adds a bit of friction to the user experience. Do you have any suggestions for enabling voice isolation, or for performing denoising in general?
Replies
2
Boosts
0
Views
115
Activity
2w
Why are none of my posts showing up in the Audio Q&A?
Why are none of my posts showing up in the Audio Q&A? There are no errors or any useful messaging... my posts just aren't showing.
Replies
2
Boosts
0
Views
83
Activity
2w
Live Activity sleep timer without push
My app has a sleep timer (up to 12 hours). Can I drive a Live Activity countdown in the Dynamic Island purely from the foreground/background app process using Activity.update(), without requiring a push notification server? And does Text(timerInterval:) in SwiftUI continue counting down accurately when the app process is suspended by the OS?
Replies
0
Boosts
0
Views
68
Activity
2w
Foundation Models for audio recommendation
Is it appropriate to use the Foundation Models framework on-device to power a natural language sound recommendation feature (e.g. user types 'I can't focus' → model returns a frequency/playlist recommendation from a predefined set)? Or is this use case better served by a custom Core ML model? What's the recommended on-device inference approach in iOS 27 for this type of structured recommendation with a small output space?
Replies
0
Boosts
0
Views
58
Activity
2w
App Intents for audio playback actions in iOS 27
With SiriKit deprecated in iOS 27, I'm implementing App Intents from scratch for a frequency/ambient sound app. Should I conform to AudioPlaybackIntent from the Media framework or build a custom AppIntent? Specifically, I need intents for: play a named frequency, start sleep timer with duration, stop playback. Is there a recommended Intent entity type for audio content that isn't music (i.e. not MusicKit-backed)?
Replies
0
Boosts
0
Views
65
Activity
2w
Does the OS has dedicated volume levels for each AVAudioSessionCategory.
We have an VoiP application, our application can be configured to amplify the PCM samples before feeding it to the Player to achieve volume gain at the receiver. In order to support this, We follow as below. If User has configured this Gain Settings within application, Application applies the amplification for the samples to introduce the gain. Application will also set the AVAudioSessionCategory to AVAudioSessionCategoryPlayback Provided the User has chosen the output to Speaker. This settings was working for us but we see there is a difference in behaviour w.r.t Volume Level System Settings between OS 26.3.1 and OS 26.4 When user has chosen earpiece as Output, then we will set the AVAudioSessionCategory to AVAudioSessionCategoryPlayAndRecord. User would have set the volume level to minimum. When user will change the output to Speaker, then we will set the AVAudioSessionCategory to AVAudioSessionCategoryPlayback. The expectation is, the volume level should be of AVAudioSessionCategoryPlayback what was set earlier instead we are seeing the volume level stays as minimum which was set to AVAudioSessionCategoryPlayAndRecord Could you please explain about this inconsistency w.r.t Volume level.
Replies
7
Boosts
0
Views
1.1k
Activity
2w
Visualization of Apple Music audio
Certain apps (eg. DJay) at least seem to have access to audio data from Apple Music streams, either directly or via an indirect dataset for visualization purposes either generated from audio data on the device or delivered from a remote service. Is there any framework provided by Apple or special agreement with Apple that gives access to Apple Music audio data, or sets of visualization meta data, or the ability to run processing of audio data on device or remotely (either on-demand or via preprocessing)?
Replies
0
Boosts
1
Views
92
Activity
2w
Building AUv3's?
Any chance of more modern framework for building AUv3's coming anytime soon?
Replies
4
Boosts
0
Views
110
Activity
2w
AUv3 "Failed to find component with type..." frequent issues
When the host app of a host/AUv3 extension pair tries to find the audio extension it fails. The system should have scanned the bundle for the extension, but this appears to fail. This basically happens in SimplePlayEngine.initComponent. I've seen this intermittent problem for years. There are many sometimes-effective workarounds that I've gathered and used, but the problem still exists. It is not a problem of validation -- the same AU can validate in some run cycles and then not be found via the host app in others. I've got a Feedback Assistant ticket for the latest iteration of the problem (FB22860885), which has affected beta testers. Usually I only see this when developing with Xcode myself. So even though the testers' app lives in ~/Applications it is still failing for some of them.
Replies
3
Boosts
1
Views
131
Activity
2w
WKWebView / MusicKit.js: Can buffered seeks void audio interruption during playback?
This question overlaps with a newer post that contains additional implementation details To avoid splitting discussion, please see: “MusicKit.js / WKWebView: Are audible hitches during seek a known WebKit or Apple Media Stack limitation?” We are building a music practice application that uses MusicKit.js inside a WKWebView on iOS and macOS. Our application requires tight musical looping, where playback repeatedly seeks back to a loop start position while a song is playing. We have observed that: • Seeking to a nearby position within already-buffered audio using HTMLAudioElement.currentTime causes an audible interruption or hitch. • Changing HTMLAudioElement.playbackRate during playback also appears to interrupt playback briefly. • These interruptions make seamless looping difficult to achieve. For comparison, a very similar JavaScript architecture running in a Chromium-based WebView on Android exhibits significantly smoother seek behavior and supports near-seamless looping. Our questions are: Is it expected that changing currentTime or playbackRate on the underlying audio element causes the playback pipeline to be interrupted or rebuilt on Apple platforms? Are there any recommended WebKit, WKWebView, or MusicKit.js techniques that can reduce or eliminate these interruptions when seeking within already-buffered media? Would native MusicKit playback provide lower-latency or more seamless seeking than MusicKit.js, or do both approaches ultimately rely on the same playback pipeline? Our use case is musical practice, where even interruptions of a few tens of milliseconds are noticeable. Any guidance on achieving the smoothest possible loop-seeking behavior on Apple platforms would be greatly appreciated.
Replies
0
Boosts
1
Views
80
Activity
2w
MusicUnderstanding and Apple Music / MusicKit
Certain apps (eg. DJay) seem to have direct or indirect access to the audio data from Apple Music, either on the device or remotely preprocessed. Is that feature available for other third party apps? Am I correct in my understanding that the new framework MusicUnderstanding (which looks quite interesting, judging from the docs so far) is not in any way usable for streams or local files from Apple Music / MusicKit since it relies entirely on AVReadOnlyAudioPCMBuffer? Is there eg. a way to get the same kind of music understanding data (or some other meta data suitable for real time visualization) provided directly form Apple Music without going via a readable audio buffer?
Replies
0
Boosts
3
Views
165
Activity
2w
Presentation mode
What's the best way of dealing with presentation mode (when the phone screen is captured by Google Meet or any other presenter software) when AudioSession is activated with .playAndRecord mode? The goal is to share the audio output between the phone and Google Meet so participants can hear it as well, while also enabling a microphone for future interactions within the app, for, let's say, voice chat.
Replies
0
Boosts
0
Views
28
Activity
2w
AVSpeechSynthesis voices
Up to iOS 18 there were many voices available on device by default including "Nicky" that I use in my app. Somewhere around iOS 18.6 or 26.0 these voices were removed and no longer included in the OS by default. This broke my app that counted on the Nicky voice being available. My only workaround is to direct my users to download the voice again by going to Accessibility > VoiceOver > Speech > Voices and downloading "Nicky". I cannot simply switch to using Samantha (the only voice that is still available by default) because I have heavily customized how IPA pronunciations are tweaked to make Nicky speak Old English correctly. I tried briefly with Samantha but the results were not as good. I have 2 questions: Is there any way for me to include the "Nicky" voice in my app or for me to trigger the download from the app so I don't have to show an error and direct users through the settings app to get the voice? Are there any new features with AI voices in iOS 27 that I can use with IPA pronunciations to get them to speak possibly better than the Nicky voice?
Replies
0
Boosts
0
Views
37
Activity
2w