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

MusicKit JS authorize() returns AUTHORIZATION_ERROR "Unauthorized" (no Music User Token) — catalog works
Hi all — hoping someone has hit this. Our MusicKit JS (v3) web app calls authorize() and it rejects with AUTHORIZATION_ERROR / "Unauthorized" (no Music User Token is issued), even though the same developer token returns HTTP 200 for catalog requests (/v1/catalog/us/search) — so the token itself is valid. Setup (all verified): MusicKit JS v3 from js-cdn.music.apple.com/musickit/v3/musickit.js; MusicKit.configure() succeeds, storefront resolves to "us". Developer token is ES256, valid, and includes the origin claim for our exact site origin. Our MusicKit key is enabled for Media Services and tied to a Media ID that has MusicKit enabled. Referrer-Policy: strict-origin-when-cross-origin. Repro: sign in with an active Apple Music subscriber and tap Allow -> authorize() rejects. Reproduces for two subscriber Apple IDs, in Chrome and Edge, with third-party cookies allowed. Error object: { name: "AUTHORIZATION_ERROR", message: "Unauthorized", isMKError: true }, thrown inside musickit.js during the authorize() flow. The served MusicKit build is a prerelease (3.2526.0-prerelease.x). We've ruled out the usual suspects on our side (origin claim, referrer policy, token validity, API version, cookies, and portal provisioning). Has anyone resolved this, or is there an additional server-side enablement needed for a team/Media ID to issue web user tokens? Also filed as FB23587284. Thanks!
2
0
707
3h
MusicTokenRequestError.unknown for some authorized, subscribed users
A small number of our users can’t connect Apple Music because DefaultMusicTokenProvider.userToken(for:options:) always throws MusicTokenRequestError.unknown. Most users connect without problems and we can’t reproduce the failure on any of our own accounts. Flow: let status = await MusicAuthorization.request() // .authorized let subscription = try await MusicSubscription.current // canPlayCatalogContent == true let provider = DefaultMusicTokenProvider() let developerToken = try await provider.developerToken(options: []) // succeeds let userToken = try await provider.userToken(for: developerToken, options: []) // throws .unknown On failure we retry once with options: .ignoreCache for both the developer token and the user token. The retry fails in the same way. What we see on affected devices: MusicAuthorization.currentStatus == .authorized MusicSubscription.current.canPlayCatalogContent == true The developer token is returned successfully. userToken(for:) throws MusicTokenRequestError.unknown. The NSError has code 0 and the localized description “Unknown error”, and there is no NSUnderlyingError. The ignoreCache retry fails after anywhere from about 10 ms to 2.5 s, so it sometimes appears to go out to the network. For a given account it fails every time: across days, app versions, and after reinstalling both our app and the Music app. Apple Music plays normally in the Music app for these users. Ruled out so far: iOS version: seen on iOS 26.6.1 and 27.2. Device model: seen on iPhone 13 and iPhone 14 Plus. Region: seen in Hungary, Italy, Romania and Japan. Subscription type: one affected user has an individual trial. A family member with her own individual trial on a separate account connects without problems. Family Sharing in general: family plan members connect fine for us. Questions: What conditions cause userToken(for:) to return .unknown instead of a specific case such as .userNotSignedIn, .permissionDenied or .privacyAcknowledgementRequired? Is there a way to get more detail about the cause? Is there a step affected users can take to fix it?
2
1
479
16h
Can a third-party app capture microphone audio while a cellular call is active?
We're building a companion app that people use during a regular cellular call (VoIP isn't an option for this call). The user wants to briefly mute the call, speak a short question into our app, then unmute. Is there any supported way for a third-party app to record from the microphone during an active cellular call, even if the call is muted or on hold? Does Siri with App Intents accept voice input during an active call? If so, is Siri's spoken response heard by the other person on the call? Can a watchOS app record audio while the paired iPhone is on a call? If none of these work, what approach do you recommend?
1
0
86
21h
MusicKit: Multichannel Dolby Atmos Limited to Stereo Output - Is This Intended Behavior?
I'm experiencing a significant limitation with MusicKit's Dolby Atmos implementation on macOS and would appreciate clarification on whether this is intended behavior or if there are solutions available. When streaming Dolby Atmos content through MusicKit's ApplicationMusicPlayer, the output is limited to 2-channel stereo, even when: Audio MIDI Setup is configured for 7.1.4 (12-channel) output The same tracks play in full multichannel through the native Apple Music app Dolby Atmos is set to "Automatic" in Apple Music preferences Please let me know if there is anyway to enable this. If not, is this documented anywhere? Thanks!
2
3
408
1d
Logic Pro: third-party effect AU not processed on an empty audio track — request for the opt-in some vendors have (aumf/Acnt/EINX)
We have a product where Logic Pro's "process effects only when needed" optimisation blocks the core use case, and we would like to ask for the opt-in that some third-party plug-ins already have. Filed as FB25426476. The plug-in ACENTAUR (Audio Unit v2, type aumf, subtype Acnt, manufacturer EINX; EINAUX, Germany) is an AI music generator that lives in the Audio FX slot of an audio track. It renders its own material from the host's tempo, time signature and transport, so the natural workflow is: empty audio track, insert ACENTAUR, press Play, generate. There is no region and no input signal. The plug-in is the source. What happens On an empty audio track Logic never calls the render callback, so the plug-in never receives the host clock through the HostCallbacks: tempo and transport stay unknown and our UI stays locked. Everything else works: the same build renders in the instrument slot, in other hosts, and on a Logic audio track as soon as a region or live input is present. Inserting Logic's Test Oscillator (bypassed) in the same strip also makes it work, which shows the strip is simply not scheduled. Logic engineering described this optimisation on coreaudio-api in February 2024 (https://www.mail-archive.com/coreaudio-api@lists.apple.com/msg01859.html). What we observed A number of third-party effects (Celemony Melodyne, Antares, Synchro Arts, Waves and others) are processed on an empty track. We verified on Logic Pro 12.4 (6707) / macOS 26.6.2 that this is tied to the plug-in's identity plus a private global property Logic queries when the plug-in is loaded: with a listed manufacturer code and that property answered, our plug-in is rendered immediately on an empty track and the host clock arrives. We are of course not going to ship under another vendor's identity; this was a one-off local test to make sure we understand the mechanism before asking. Log excerpt from that test (plug-in log, out-of-process hosting, empty audio track, 48 kHz): 09:19:38 host asked property 101000 → 0 09:19:38 host asked property 101001 → 1 09:19:38 Initialize → 0 · in 2 ch @ 48000 Hz · out 2 ch 09:19:39 First render after 0s · input callback · tempo 120.00 Same build under our own manufacturer code EINX: "No render after 30s · host clock tempo+transport · flags 0". The request Could ACENTAUR (aumf / Acnt / EINX) be added to the set of plug-ins Logic keeps processing without input? The plug-in already answers the property in question; the only missing piece is on Logic's side. If there is a different or public mechanism you would prefer third parties to adopt (a component tag, an AU property, an AUv3 property), we will implement it right away. Happy to provide a build, a demo project and whatever else helps. Christoph Kahse, EINAUX
0
0
50
3d
macOS 27 regression: HDMI + DisplayPort Multi-Output audio fails with Core Audio error 1937010544
Hi, I believe I have found a Core Audio regression in macOS 27. This exact hardware configuration worked correctly on macOS 26, and the issue started immediately after upgrading to macOS 27. Hardware: Mac mini M2 2 × MSI MP243X monitors Monitor 1 connected via HDMI Monitor 2 connected via DisplayPort Both monitors expose a 2-channel audio output to macOS On macOS 26: I used Audio MIDI Setup to create a Multi-Output Device containing both MSI MP243X audio outputs. Audio played simultaneously through both monitors without any issues. On macOS 27: Both audio devices are still detected correctly and both work perfectly when selected individually: HDMI only: WORKS DisplayPort only: WORKS HDMI + DisplayPort simultaneously: FAILS This is reproducible even immediately after a full reboot. When I create a new Multi-Output Device containing both MSI outputs and select it as the system output, audio playback cannot start. For example: afplay /System/Library/Sounds/Glass.aiff returns: Error: AudioQueueStart failed ('stop') I captured Core Audio debug logs while reproducing the problem. Core Audio initially reports that StartIO succeeded, but the physical display audio device then fails to establish a timeline. Relevant log messages include: HALS_IOEngine2::_StartIO succeeded Device 3669B540-0000-0000-2623-0104A5351D78 is not running. could not establish a timeline after waiting 10000000 microseconds stopping with error 1937010544 StartIOThread: the IO thread failed to start, Error: 1937010544 I have already tested the following: Both devices at 44.1 kHz / 24-bit Both devices at 48 kHz / 16-bit Recreating the Multi-Output Device from scratch Using the HDMI device as clock source Using the DisplayPort device as clock source Different drift correction configurations Restarting coreaudiod Full macOS reboot Testing both outputs individually immediately after reboot Alternative multi-device audio routing software The behavior is always reproducible. Each MSI MP243X audio endpoint works correctly by itself. The failure only occurs when both HDMI and DisplayPort audio endpoints are opened simultaneously. system_profiler correctly detects both devices at 48 kHz: MSI MP243X Output Channels: 2 Current Sample Rate: 48000 Transport: HDMI MSI MP243X Output Channels: 2 Current Sample Rate: 48000 Transport: DisplayPort This does not appear to be a problem with either monitor or connection individually, because both outputs continue to work independently. The important difference is the macOS version: macOS 26: HDMI + DisplayPort Multi-Output = WORKING macOS 27: HDMI only = WORKING DisplayPort only = WORKING HDMI + DisplayPort Multi-Output = FAILS with AudioQueueStart 'stop' / Core Audio error 1937010544 No hardware, monitor, cable, or connection changes were made between the working macOS 26 configuration and the macOS 27 configuration. This therefore appears to be a regression in the Core Audio/display-audio path introduced with macOS 27 when two display audio endpoints (HDMI + DisplayPort) are opened simultaneously. Has anyone else been able to reproduce this on macOS 27, particularly on Apple Silicon? I can provide the complete coreaudiod logs and run additional Core Audio diagnostics if needed. Additional isolation tests: Both monitors can remain physically connected to the Mac at the same time. With both HDMI and DisplayPort connected: Selecting the HDMI MSI MP243X as the only output works correctly. Selecting the DisplayPort MSI MP243X as the only output works correctly. Opening both audio endpoints simultaneously causes the failure. Therefore, simply having both displays connected does not trigger the issue. The failure appears specifically when Core Audio attempts to run both display-audio endpoints at the same time. I also tested this using third-party multi-device audio routing implementations instead of relying only on Audio MIDI Setup. The same behavior occurs: either MSI MP243X can be opened and used independently, but attempting to route audio to both devices simultaneously fails. This suggests that the issue is below the Multi-Output Device configuration itself and may be related to starting/synchronizing two display-audio IO engines simultaneously. During the failure, the Core Audio log sequence is particularly interesting: The physical device is detected normally. The audio format is configured successfully. Core Audio reports that StartIO succeeded. The device subsequently reports that it is not running. Core Audio waits 10 seconds for a timeline. Timeline establishment fails. The IO thread terminates with error 1937010544 ('stop'). One captured conversion path was: 2 ch, 48000 Hz, Float32, interleaved -> 2 ch, 48000 Hz, Int16, interleaved so both sides were operating at 48 kHz during this test. Another important observation is that restarting coreaudiod does not resolve the simultaneous-output problem. A complete reboot also does not resolve it: immediately after a fresh boot, before launching any third-party audio-routing software, both physical outputs work individually but a newly created Multi-Output Device still reproduces the failure. This makes the issue highly reproducible on this machine. Minimal reproduction: Boot macOS 27 with both MSI MP243X monitors connected. Open Audio MIDI Setup. Verify both MSI MP243X devices work independently. Set both devices to 48,000 Hz. Create a new Multi-Output Device. Select both MSI MP243X devices. Select the new Multi-Output Device as the system audio output. Run: afplay /System/Library/Sounds/Glass.aiff Expected result: The sound is reproduced simultaneously through both monitors, as it was on macOS 26. Actual result: Error: AudioQueueStart failed ('stop') Switching the system output back to either individual MSI MP243X restores audio playback. The problem can then be reproduced again by selecting the Multi-Output Device.
6
8
2k
6d
AUv2: Property Listener Callback Lifetime During AudioComponentInstanceDispose
Title: AUv2: Property Listener Callback Lifetime During AudioComponentInstanceDispose I’m developing a macOS Audio Unit v2 (AUv2) instrument in C++ and investigating the correct lifetime and synchronization requirements for property-listener callbacks. I would appreciate clarification from Apple engineers or developers with direct AUv2 implementation experience. Specifically: Does AudioComponentInstanceDispose guarantee that the Audio Unit’s Close operation has completed before the call returns? Does disposal guarantee that all property-listener callbacks registered through AudioUnitAddPropertyListener have finished executing before the instance and its associated callback data can be destroyed? What are the documented guarantees of AudioUnitRemovePropertyListenerWithUserData regarding callbacks that are currently executing or already queued? Is there a documented synchronization procedure that allows an AUv2 plug-in to safely release listener callback state during instance shutdown? Are there host-ordering requirements or documented assumptions that plug-in developers must follow when registering, removing, and destroying property listeners? My implementation is designed to avoid use-after-free, concurrent access to destroyed objects, and unsafe callback-data reclamation. I want to base the implementation on documented Apple API guarantees rather than assumptions about host behaviour. If relevant, please point me to the authoritative documentation or recommended implementation pattern. Environment: macOS 12 Monterey, Xcode 14.2, AUv2 instrument, C++.
0
0
261
1w
macOS 27.2: second Bluetooth HFP microphone is silent despite two SCO connections
Hello Apple engineers and developers, My name is Fumikazu Kondo. I am an independent developer in Japan working on transcription applications, including KF Transcription Mixer. I want to capture two separately connected Bluetooth microphones on a Mac for meeting and conversation transcription. I would appreciate an Apple engineer's response about the supported behavior and a reliable solution. Problem Each microphone works when captured individually. When both are opened, the second input delivers only zeros, even though Core Audio starts successfully and macOS reports two SCO connections. The failure also reproduces with direct native Core Audio capture before any application audio processing. Environment MacBook Pro, Apple M5, model identifier Mac17,2 macOS 27.2; sw_vers reports build 26B123 Xcode 27.1 (27A9275), macOS 27.0 SDK Built-in Bluetooth controller: BCM_4388C2, firmware 24.2.241.1936 Microphones: Beats Pill (firmware 2C336) and SANWA SUPPLY MM-BTCL1 (firmware 1.0.0), both directly connected to the Mac Both input devices expose 16,000 Hz, mono. Bluetooth logs show HFP/mSBC. Microphone Mode: Standard; preferred and active values both read back as 0 Reproduction Connect both microphones to the Mac. Confirm each delivers real audio in a separate, fresh capture process. In Audio MIDI Setup, create an Aggregate Device with the two microphone input devices, one channel each. Use 16 kHz, one clock source, and drift correction for the other device. Start capture of the two channels. Use a controlled speech fixture played through the Mac's built-in speakers so that both microphones receive sound. Observe that one channel has audio and the other is entirely silent. I also reproduced the problem using AudioDeviceCreateIOProcID / AudioDeviceStart directly on the physical input devices, without an aggregate or application processing. Reversing their opening order changed which microphone remained silent: the later-opened device delivered zeros. Measured results Physical Mac XCTest runs on October 30, 2026: MM-BTCL1 alone: 203,520 captured frames; 232 nonzero observation windows; passed. Beats Pill alone: 203,520 captured frames; 233 nonzero observation windows; passed. Two-input aggregate: 202,240 frames; nonzero windows [240, 0]; simultaneous windows 0; application audio error 0. Separate native shared-clock experiment: an aggregate containing both microphone inputs plus the built-in speaker, driven by one full-duplex IOProc. 1,152 input callbacks and 1,152 output buffers; nonzero callback counts [1100, 0]; simultaneous windows 0; invalid samples 0. The last experiment rules out simply lacking a running output clock in the input-only capture path, but it did not fix the issue. Relevant system log messages include: Number of SCO Connections: 2. A2DP Streaming State: 0. Input Decode: Requested 640 bytes, but only read 0 bytes instead. Decoded a total of 0 bytesThe decode message repeats during the silent input. Successful voice-audio connection events appear for both devices. Device identifiers and unrelated logs are omitted here. Already tested Both microphones power-cycled and individually reconnected Mac restarted; issue reproduced afterward Standard microphone mode verified by readback Both microphones individually verified with the same controlled stimulus Reversed native device opening order Persistent and private aggregates; different clock choices and drift correction Direct physical-device IOProc capture Full-duplex shared-clock capture with the built-in speaker Built-in speaker selected as system output, with Bluetooth output streaming stopped during measurement Core Audio and Bluetooth services restarted; issue persisted Software Update reports no new software available I have not established whether the cause is in the OS, driver, controller, or device firmware. I am not claiming a universal Bluetooth specification limitation. Questions for Apple Is simultaneous capture from two directly connected HFP/mSBC microphones supported on this Mac/macOS configuration through Core Audio? If there is a limitation, could you provide the relevant documentation and clarify its scope? If supported, which public API or configuration should be used to keep both input streams delivering audio? Is there a known issue or supported workaround for the all-zero second stream? Which targeted Bluetooth/HCI logs or minimal reproduction details would Apple need to investigate? I can provide a focused reproduction and redacted measurements through an appropriate private channel if needed. This is blocking reliable two-microphone transcription. Please respond with the expected behavior, next diagnostic steps, or the appropriate Apple engineering support route. Thank you for your help. Update: also reproduced with two Beats Pill speakers On October 30, 2026, I replaced the MM-BTCL1 with a second Beats Pill. Both Beats Pill speakers report firmware 2C336 and are independently connected to this Mac. Microphone Mode remains Standard (0). Fresh individual controls after previous SCO connections fully disconnected: both work (235 and 236 nonzero observation windows). Application-created private aggregate, device order A/B: nonzero windows [233, 0]. Reversed participant order: [0, 240]. Direct physical-device IOProc test, opening A before B: callback counts [404, 402], but nonzero callback counts [403, 0]. No simultaneous audio windows. After releasing both and restarting B alone, B delivers audio (381 nonzero callbacks). Opening A while B continues then yields nonzero counts [0, 404]: the later-opened device is again silent. System logs again report two SCO connections and repeated zero-byte input decode messages. Thus the same failure also reproduces with two same-model, same-firmware Apple/Beats devices. Please include this configuration when assessing support status, a possible known issue, and recommended next steps. Additional comparison reported by the user: the MacBook built-in microphone and one Beats Pill can both be heard when used together. This is a user-observed working configuration, separate from the automated tests above. It further narrows the problem to the configuration with two simultaneous Bluetooth microphone inputs.
0
0
226
1w
Using Apple Music API artist artwork and library import on a music rating website
Hi all, We run Soundmark, a small UK website where people rate and review albums and songs (web only for now, a native app may come later). We'd like to use the Apple Music API in two ways, and want to make sure we stay within the rules before building anything: Show artist images on our artist pages. Let users connect their Apple Music account and import their library, so the albums and songs they already have show up on Soundmark ready to rate. Our setup today: Album and song pages have a small player that plays 30-second previews. On desktop, some pages also show the Spotify embed player. There are no ads on the site. We would show the Apple Music badge and a link to Apple Music alongside any Apple content, following the Apple Music Identity Guidelines. Our questions: Can a website use artist artwork from the Apple Music API if it only plays 30-second previews, or does it need full MusicKit on the web playback (users connecting their Apple Music account)? Can the artist image appear on a page that also shows a Spotify embed player, or does it need to be on pages with Apple Music playback only? Beyond Apple's own terms, do we need separate permission from rights-holders to display artist images, or is the API licence enough when used as described? Can we import catalog data (album and song titles, tracklists, release dates and cover art) from the Apple Music API and store it permanently in our own database, so our album and song pages are built from it? Can those pages be shown to everyone, including visitors without an Apple Music account, and are there limits on caching cover art or on how many albums we import (rate limits)? We also emailed Apple Developer Support on 21st October and chased on the 28th but haven't heard back yet, so any pointers to the relevant terms would be really appreciated. Thanks!
0
0
73
1w
Supported integration path for two-deck Apple Music DJ playback on iPhone, iPad and Mac Catalyst
We develop SpinCut DJ, a free-to-download proprietary DJ application by LALAMO CORPORATION for iPhone, iPad and Mac Catalyst. We want to add Apple Music subscription playback for users with an active subscription, similar to the integrations featured in DJ with Apple Music. This question is about the officially supported integration path, not extracting or bypassing protected audio. Our existing engine uses app-owned PCM for two independently controlled decks, scratch/reverse playback, tempo changes, hot cues, loops, beat synchronization and independent master/headphone outputs. We have reviewed MusicAuthorization, MusicSubscription, catalog/library requests, ApplicationMusicPlayer and SystemMusicPlayer. We understand that ordinary catalog access and protected queue playback do not establish a documented route to feed subscription audio into our custom engine, or permission to modify or synchronize MusicKit content. We have not enabled subscription-catalog DJ playback. Apple Developer Support advised us to ask the Developer Forums about the required technical integration. Could an Apple representative clarify: Is there a documented public API for two independent, simultaneous Apple Music DJ decks with scratch/reverse/tempo control? If a separate Apple Music DJ integration, agreement, SDK or capability is required, what is the current official application or referral process for a Japan-based developer? Are iOS, iPadOS and Mac Catalyst supported through the same integration, and what technical material is required for evaluation? What approved interfaces govern waveform/beat analysis, seeking and separate master/headphone routing? We are not requesting recording/export, stem separation, offline file extraction or rebroadcast permission through ordinary MusicKit. Those features would remain unavailable for subscription content unless separately and expressly supported. We can provide a product demonstration and integration brief through an appropriate private channel. Product: https://spincutdj.com/ App Store: https://apps.apple.com/app/id6804328893 Please point us to the supported technical and onboarding path rather than an undocumented entitlement or workaround.
0
0
279
1w
TTS Stuttering & Noise
TTS Stuttering & Noise When using Apple’s native TTS API on an iPhone or iPad—specifically while connected to Bluetooth earphones or headsets—users are experiencing audio noise or intermittent gaps in speech, causing parts of sentences to drop out during playback. There were no reports or inquiries regarding such issues up through iOS/iPadOS 26. Since the release of iOS/iPadOS 27, however, there has been a significant increase in reports and inquiries about this problem. If you happen to know the cause of this issue or have any suggestions for a fix, please leave a reply. The issue persists even after removing the AirPods or headset from the device and reconnecting them. The issue persists even after rebooting the device. The issue occurs even on the latest versions, from iOS/iPadOS 27 through 27.2.
0
0
89
1w
Title: MusicKit Web v3 authorize() fails with AUTHORIZATION_ERROR after Allow — Windows Chrome/Edge (FB25267497)
Hello Apple engineers and fellow developers, I am developing CloudMusic Bridge, a Windows desktop music application integrating the official MusicKit Web v3 SDK. MusicKit initialization succeeds, but authorize() consistently rejects with AUTHORIZATION_ERROR after the user clicks Allow in Apple's official authorization window. Environment Windows, Google Chrome and Microsoft Edge MusicKit Web v3 from Apple's official CDN Local HTTPS origin: https://localhost:4318 Valid ES256 developer token with a matching origin claim MusicKit-enabled Media ID and associated Media Services key Active Apple Music subscription, with full-song playback working on music.apple.com Catalog API requests succeed (HTTP 200) Actual MusicKit SDK build: UNKNOWN Reproduction I created a standalone minimal reproduction that loads MusicKit, initializes it, obtains the instance and invokes instance.authorize() directly from a user click. The user signs in and clicks Allow, but the authorization Promise rejects. I also tested a separate page that explicitly allows https://play.itunes.apple.com in both CSP connect-src policies. This eliminated the previously observed document CSP violations during the comparison, but authorization still failed with AUTHORIZATION_ERROR after approximately 46.6 seconds. The application did not reach its 120-second timeout. Questions for Apple DTS How can I verify that my browser is loading the current supported stable MusicKit Web v3 build? Is there any additional developer configuration required for web authorization? How can I safely identify the underlying authorization exchange failure? Since this reproduces on Windows, what diagnostics should I provide instead of macOS sysdiagnose? Could an Apple engineer help investigate my existing report, FB25267497? I have already contacted Apple Developer Support and was directed to the Developer Forums for SDK-related technical assistance. I can provide a sanitized minimal reproduction and diagnostic timeline. Thank you for your help.
2
0
392
1w
AVAudioSession ioBufferDuration always default to 512 samples on MacOS27 no matter what is requested
Hello, I develop an audio processing demo app that has been working fine on iOS/iPad and on Mac ("developed for iPad") until I upgraded to MacOS27. The app is demonstrating low latency / high temporal resolution audio spectral analysis. I am using AVAudioSession, I request the audio IO buffer to be 32 samples. This still works fine on iOS/iPadOS, but it seems that when running on MacOS27 the buffer size always defaults to 512 samples no matter what I request (smaller or larger). This applies to the "Designed for iPad" version running on MacOS and any version running in the iPhone and iPad simulators on MacOS. The app seems to be working as intended on physical iPhones and iPads. I made a catalyst version and used AudioObjectSetPropertyData to force the IO bugger sizes to 32 samples on the system's active hardware device. This seems to succeed but still results in incorrect behaviour in my app; I am still diagnosing but I believe it's because this leaves AVAudioSession with incorrect data, and I am using AudioKit which relies on AVAudioSession (not confirmed). Regardless, is this change in behaviour intentional in MacOS27? Is there a way around it? The whole point of my app is to demonstrate efficient audio processing with very low latency - I need small input buffer size for that. Thank you for any help with this
1
0
334
1w
Is there a supported API to open a computer-synced album’s Library page in Music on iOS?
I’m building a personal iPhone app that organizes my music library. When I tap an album in my app, I want Apple’s Music app to open directly to that album’s page in Library, showing the tracks synced from my computer. My app can already read the albums and their tracks using MusicKit. I’ve tried normal Apple Music sharing links, but those open the catalog version of the album. I need the page I see when I find the album through Library in the Music app. Starting or changing playback is fine, but the album page must appear. Only starting the music or opening Now Playing would not be enough. Is there a supported API or link format that can do this? A documentation link or a small code example would be helpful.
1
0
266
1w
CABTMIDICentralViewController in SwiftUI broken on iOS 27
When wrapping CABTMIDICentralViewController in a UIViewControllerRepresentable and presenting modally, I experience layout crashes since iOS 27. Does anyone have a workaround? import SwiftUI import CoreAudioKit struct BluetoothButton: View { @State var showsBluetooth = false let title = "Check for Bluetooth MIDI Devices" var body: some View { #if os(macOS) Button { let wc = CABTLEMIDIWindowController() wc.showWindow(nil) } label: { label } #else Button { showsBluetooth = true } label: { label } .sheet(isPresented: $showsBluetooth) { BluetoothCentralView() } #endif } var label: some View { Text(title) } } #if os(iOS) struct BluetoothCentralView: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> CABTMIDICentralViewController { return CABTMIDICentralViewController() } func updateUIViewController(_ uiViewController: CABTMIDICentralViewController, context: Context) { } } #endif
7
0
1.5k
1w
MusicKit tvOS — Some personal library songs fail with Error Code 6, while others play successfully
Hi everyone, I’m developing a native Apple TV application using MusicKit for Swift. The app provides a custom interface for browsing and playing the user’s personal Apple Music library. The application was working correctly for several months, but recently certain songs from the user’s personal library have stopped playing. I’ve been investigating this issue extensively and have reproduced it in a completely separate, minimal tvOS test application. The issue I retrieve songs using MusicLibraryRequest() and play them using ApplicationMusicPlayer. Some songs play successfully, while others consistently fail during playback preparation with: `MPMusicPlayerControllerErrorDomain Code=6 "Prepare to play failed"` The underlying errors include : NSCocoaErrorDomain Code=4099 Example of a failing song Michael Jackson — Bad (2012 Remaster) Library song ID: i.ldDOAp0UrAa62J Successfully retrieved using MusicLibraryRequest() Fails when queued with ApplicationMusicPlayer Also fails with SystemMusicPlayer Example of a working song Harry Nilsson — Everybody’s Talkin’ (1971 Mix) Library song ID: i.WmYQp9PcdZ4Y0E Retrieved using the exact same MusicLibraryRequest() Successfully plays using ApplicationMusicPlayer Both songs have library identifiers beginning with i.. What I’ve tested ApplicationMusicPlayer with prepareToPlay() followed by play(). SystemMusicPlayer with the same library song. Direct play() without explicitly calling prepareToPlay(). Retrieving songs directly using MusicLibraryRequest(), rather than accessing them through albums. A completely separate minimal tvOS application. An older version of my application’s code, recompiled using the current Xcode version. The issue persists across these tests. Interestingly, the corresponding Apple Music catalog song plays successfully when retrieved through MusicCatalogSearchRequest. However, replacing library songs with catalog equivalents is not an acceptable solution because the application needs to support users’ actual personal libraries, including imported music. Important observation The exact same failing song plays correctly on the same Apple TV and Apple Music account in: The official Apple Music application. Sleeve, another third-party Apple TV music player. This suggests that the song itself is playable and that another third-party application can successfully initiate playback. Environment Platform: tvOS Device: Physical Apple TV Framework: MusicKit for Swift Apple Music authorization: Granted MusicKit App Service: Enabled Signing: Automatic, using a paid Apple Developer account Question Is there a known issue with resolving or playing certain personal library songs through MusicKit on tvOS? Are there additional playback parameters, library synchronization requirements, or recommended queue configurations that could explain why some MusicLibraryRequest() items fail while others work? Has anyone encountered a similar issue or found a workaround that preserves playback of the user’s actual library items? Any guidance would be greatly appreciated. Thank you!
2
0
506
1w
AVAudioSession blocks 20–36s on A2DP→HFP switch while another AudioUnit is rendering (iOS 27.0.1, AirPods Spatial Audio)
While an AVAudioPlayer/AudioUnit is rendering to AirPods over A2DP with system Spatial Audio + Head Tracking enabled, switching the shared AVAudioSession to playAndRecord + voiceChat (A2DP → HFP) blocks the main thread for tens of seconds on synchronous AVAudioSession APIs (setCategory / setMode / channel getters / setPreferred*). iOS hang detection reports a Severe Hang of 41.02 s. Stopping playback and deactivating the session before the identical switch completes in ~87 ms. Feedback: FB25324099 Environment iPhone 15 Pro (iPhone16,1), iOS 27.0.1 (24A446) AirPods worn; Spatial Audio + Head Tracking on AVFoundation-only repro (no third-party SDK): https://github.com/shinobuwz/ios27-spatial-audio-stall-repro Info.plist: LSApplicationCategoryType = public.app-category.games, LSSupportsGameMode = YES; does NOT set AVGameBypassSystemSpatialAudio (those two keys are required for system Spatial Audio on this path) Steps Wear AirPods with Spatial Audio + Head Tracking enabled Launch the repro app; allow mic (or use auto-repro) Play 440 Hz (BluetoothA2DP, spatial=1) After ~2 s, run Repro: keep playing and switch to PlayAndRecord + VoiceChat Compare with Control: stop playback + setActive:NO, then the same switch Expected: each call returns in ms; whole reconfiguration ≪ 50 ms Actual (cold launches): configuration total 20.8–28.9 s (options=13); with options=237 ≈ 36.2 s; first input buffer ~40–58 s from switch start. Control ≈ 87 ms. Evidence in the repo: docs/MEASUREMENTS-2026-10-26.md, evidence/*.log, hangs.xml, main-thread stacks in avas::client::SessionCore (sync XPC to the audio daemon). Even inputNumberOfChannels / outputNumberOfChannels getters stall for seconds. Question: Is this a known regression on iOS 27? Any workaround besides stopping all rendering AudioUnits before the HFP switch? Happy to attach sysdiagnose / Instruments / screen recording if useful.
0
0
452
1w
Can third-party apps access Apple Music concert listings?
I’m developing Segue, an iPhone and Apple Watch app for discovering concerts and keeping personal concert memories. Apple Music artist pages display upcoming concerts, including dates, venues, lineups, and ticket links. I would like users to search for an artist and view those concerts directly within Segue. Is there a supported public API or Apple framework for accessing these concert listings? I reviewed MusicKit and Apple Music API documentation but couldn’t find concert-related endpoints. Example Apple Music concert: https://music.apple.com/us/concerts/ce.91c8bd7d-0669-4c33-8c2a-6809b9f65129 If this requires separate partner access or approval, could you direct me to the appropriate team?
0
0
149
1w
SFSpeechRecognizer is unavailable or fails to initialize on iOS 26.4 and 26.5 Simulators
I am testing SFSpeechRecognizer using the en_US locale. When the iPhone Simulator’s system language is set to Japanese, SFSpeechRecognizer.isAvailable returns false for en_US, so speech recognition is unavailable. As far as I have tested, this issue does not occur on iOS Simulator 26.2 or earlier. Is this a Simulator-specific issue, or is it a behavior change that could also occur on physical devices? Has any additional setup become necessary to use speech recognition in Simulator? I then changed the iPhone Simulator’s system language to English. After doing so, SFSpeechRecognizer.isAvailable returned true for en_US. However, starting a recognition task still failed immediately with kLSRErrorDomain Code=300, “Failed to initialize recognizer.” The following error was returned: Error Domain=kLSRErrorDomain Code=300 "Failed to initialize recognizer" UserInfo={ NSLocalizedDescription=Failed to initialize recognizer, NSUnderlyingError={ Error Domain=kLSRErrorDomain Code=300 "Failed to create recognizer from=/Users/<USERNAME>/Library/Developer/CoreSimulator/Devices/<DEVICE-UUID>/data/private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_UAF_Siri_Understanding/purpose_auto/ c079bfa6b8856202dc8cb2135fef3b06229ced6e.asset/AssetData/mini.json" UserInfo={ NSLocalizedDescription=Failed to create recognizer from=/Users/<USERNAME>/Library/Developer/CoreSimulator/Devices/<DEVICE-UUID>/data/private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_UAF_Siri_Understanding/purpose_auto/ c079bfa6b8856202dc8cb2135fef3b06229ced6e.asset/AssetData/mini.json } } } I have not observed either of these issues on iOS Simulator 26.2 or earlier: With the Simulator language set to Japanese, the en_US recognizer does not become unavailable. When SFSpeechRecognizer.isAvailable is true, recognition does not fail with kLSRErrorDomain Code=300. Environment Xcode: 26.6 (17F113) iOS Simulator 26.5 (23F77), iPhone 17 (A3258J/A) iOS Simulator 26.4 (23E244), iPhone 17 (A3258J/A)
1
1
1.9k
2w
AVAudioRecorder loses earlier audio after Siri with iOS 27 lifecycle notifications
I’m migrating to the new notifications described in Handling audio interruptions. On an iPhone 14 running iOS 27.0.1 (24A446), I call pause() when the system deactivates the session. On .shouldResume, I await successful session.activate() and call record() on the same recorder. It returns true, but the saved file contains only the audio recorded after Siri. To reproduce: record for five seconds, invoke and dismiss Siri, record for another five seconds, then stop and play. The earlier five seconds are missing. A legacy-notification control preserved both portions on the same phone. Is another step required to preserve the recording with the new notifications, or is this a known issue? I found this similar report, although it uses the legacy API. Minimal reproduction Built with Xcode 27.1. Create a SwiftUI iOS app targeting iOS 27, replace its generated App.swift with the code below, and add these Info.plist entries: NSMicrophoneUsageDescription: Test audio recording UIBackgroundModes: an array containing audio import SwiftUI import AVFoundation @main struct RecorderReproApp: App { var body: some Scene { WindowGroup { RecorderReproView() } } } @MainActor struct RecorderReproView: View { private let session = AVAudioSession.sharedInstance() private let file = URL.documentsDirectory.appendingPathComponent("recording.m4a") @State private var recorder: AVAudioRecorder? @State private var player: AVAudioPlayer? @State private var running = false @State private var interrupted = false @State private var status = "Ready" var body: some View { VStack(spacing: 24) { Button("Start") { Task { await start() } }.disabled(running) Button("Stop") { running = false interrupted = false recorder?.stop() status = file.path }.disabled(!running) Button("Play") { do { player = try AVAudioPlayer(contentsOf: file) status = "Saved duration: \(player!.duration) seconds" player?.play() } catch { status = error.localizedDescription } }.disabled(running) Text(status) } .padding() .task { for await notification in NotificationCenter.default.notifications( named: AVAudioSession.didBecomeInactiveNotification, object: session ) { guard running, let context = notification.userInfo?[AVAudioSession.deactivationContextKey] as? AVAudioSession.DeactivationContext, context.source == .system else { continue } recorder?.pause() interrupted = true status = "Interrupted" } } .task { for await notification in NotificationCenter.default.notifications( named: AVAudioSession.resumptionRecommendationNotification, object: session ) { guard running, interrupted, let context = notification.userInfo?[AVAudioSession.resumptionContextKey] as? AVAudioSession.ResumptionContext else { continue } guard context.recommendation == .shouldResume else { interrupted = false continue } do { guard try await session.activate(), running, interrupted else { continue } status = "Resumed: \(recorder!.record())" interrupted = false } catch { status = error.localizedDescription } } } } private func start() async { guard await AVAudioApplication.requestRecordPermission() else { return } do { try session.setCategory(.playAndRecord) guard try await session.activate() else { return } recorder = try AVAudioRecorder(url: file, settings: [ AVFormatIDKey: kAudioFormatMPEG4AAC_HE, AVSampleRateKey: 44_100, AVEncoderBitRateKey: 32_000, AVNumberOfChannelsKey: 2 ]) running = recorder!.record() status = "Recording: \(running)" } catch { status = error.localizedDescription } } }
0
0
476
2w
MusicKit JS authorize() returns AUTHORIZATION_ERROR "Unauthorized" (no Music User Token) — catalog works
Hi all — hoping someone has hit this. Our MusicKit JS (v3) web app calls authorize() and it rejects with AUTHORIZATION_ERROR / "Unauthorized" (no Music User Token is issued), even though the same developer token returns HTTP 200 for catalog requests (/v1/catalog/us/search) — so the token itself is valid. Setup (all verified): MusicKit JS v3 from js-cdn.music.apple.com/musickit/v3/musickit.js; MusicKit.configure() succeeds, storefront resolves to "us". Developer token is ES256, valid, and includes the origin claim for our exact site origin. Our MusicKit key is enabled for Media Services and tied to a Media ID that has MusicKit enabled. Referrer-Policy: strict-origin-when-cross-origin. Repro: sign in with an active Apple Music subscriber and tap Allow -> authorize() rejects. Reproduces for two subscriber Apple IDs, in Chrome and Edge, with third-party cookies allowed. Error object: { name: "AUTHORIZATION_ERROR", message: "Unauthorized", isMKError: true }, thrown inside musickit.js during the authorize() flow. The served MusicKit build is a prerelease (3.2526.0-prerelease.x). We've ruled out the usual suspects on our side (origin claim, referrer policy, token validity, API version, cookies, and portal provisioning). Has anyone resolved this, or is there an additional server-side enablement needed for a team/Media ID to issue web user tokens? Also filed as FB23587284. Thanks!
Replies
2
Boosts
0
Views
707
Activity
3h
MusicTokenRequestError.unknown for some authorized, subscribed users
A small number of our users can’t connect Apple Music because DefaultMusicTokenProvider.userToken(for:options:) always throws MusicTokenRequestError.unknown. Most users connect without problems and we can’t reproduce the failure on any of our own accounts. Flow: let status = await MusicAuthorization.request() // .authorized let subscription = try await MusicSubscription.current // canPlayCatalogContent == true let provider = DefaultMusicTokenProvider() let developerToken = try await provider.developerToken(options: []) // succeeds let userToken = try await provider.userToken(for: developerToken, options: []) // throws .unknown On failure we retry once with options: .ignoreCache for both the developer token and the user token. The retry fails in the same way. What we see on affected devices: MusicAuthorization.currentStatus == .authorized MusicSubscription.current.canPlayCatalogContent == true The developer token is returned successfully. userToken(for:) throws MusicTokenRequestError.unknown. The NSError has code 0 and the localized description “Unknown error”, and there is no NSUnderlyingError. The ignoreCache retry fails after anywhere from about 10 ms to 2.5 s, so it sometimes appears to go out to the network. For a given account it fails every time: across days, app versions, and after reinstalling both our app and the Music app. Apple Music plays normally in the Music app for these users. Ruled out so far: iOS version: seen on iOS 26.6.1 and 27.2. Device model: seen on iPhone 13 and iPhone 14 Plus. Region: seen in Hungary, Italy, Romania and Japan. Subscription type: one affected user has an individual trial. A family member with her own individual trial on a separate account connects without problems. Family Sharing in general: family plan members connect fine for us. Questions: What conditions cause userToken(for:) to return .unknown instead of a specific case such as .userNotSignedIn, .permissionDenied or .privacyAcknowledgementRequired? Is there a way to get more detail about the cause? Is there a step affected users can take to fix it?
Replies
2
Boosts
1
Views
479
Activity
16h
Can a third-party app capture microphone audio while a cellular call is active?
We're building a companion app that people use during a regular cellular call (VoIP isn't an option for this call). The user wants to briefly mute the call, speak a short question into our app, then unmute. Is there any supported way for a third-party app to record from the microphone during an active cellular call, even if the call is muted or on hold? Does Siri with App Intents accept voice input during an active call? If so, is Siri's spoken response heard by the other person on the call? Can a watchOS app record audio while the paired iPhone is on a call? If none of these work, what approach do you recommend?
Replies
1
Boosts
0
Views
86
Activity
21h
MusicKit: Multichannel Dolby Atmos Limited to Stereo Output - Is This Intended Behavior?
I'm experiencing a significant limitation with MusicKit's Dolby Atmos implementation on macOS and would appreciate clarification on whether this is intended behavior or if there are solutions available. When streaming Dolby Atmos content through MusicKit's ApplicationMusicPlayer, the output is limited to 2-channel stereo, even when: Audio MIDI Setup is configured for 7.1.4 (12-channel) output The same tracks play in full multichannel through the native Apple Music app Dolby Atmos is set to "Automatic" in Apple Music preferences Please let me know if there is anyway to enable this. If not, is this documented anywhere? Thanks!
Replies
2
Boosts
3
Views
408
Activity
1d
Logic Pro: third-party effect AU not processed on an empty audio track — request for the opt-in some vendors have (aumf/Acnt/EINX)
We have a product where Logic Pro's "process effects only when needed" optimisation blocks the core use case, and we would like to ask for the opt-in that some third-party plug-ins already have. Filed as FB25426476. The plug-in ACENTAUR (Audio Unit v2, type aumf, subtype Acnt, manufacturer EINX; EINAUX, Germany) is an AI music generator that lives in the Audio FX slot of an audio track. It renders its own material from the host's tempo, time signature and transport, so the natural workflow is: empty audio track, insert ACENTAUR, press Play, generate. There is no region and no input signal. The plug-in is the source. What happens On an empty audio track Logic never calls the render callback, so the plug-in never receives the host clock through the HostCallbacks: tempo and transport stay unknown and our UI stays locked. Everything else works: the same build renders in the instrument slot, in other hosts, and on a Logic audio track as soon as a region or live input is present. Inserting Logic's Test Oscillator (bypassed) in the same strip also makes it work, which shows the strip is simply not scheduled. Logic engineering described this optimisation on coreaudio-api in February 2024 (https://www.mail-archive.com/coreaudio-api@lists.apple.com/msg01859.html). What we observed A number of third-party effects (Celemony Melodyne, Antares, Synchro Arts, Waves and others) are processed on an empty track. We verified on Logic Pro 12.4 (6707) / macOS 26.6.2 that this is tied to the plug-in's identity plus a private global property Logic queries when the plug-in is loaded: with a listed manufacturer code and that property answered, our plug-in is rendered immediately on an empty track and the host clock arrives. We are of course not going to ship under another vendor's identity; this was a one-off local test to make sure we understand the mechanism before asking. Log excerpt from that test (plug-in log, out-of-process hosting, empty audio track, 48 kHz): 09:19:38 host asked property 101000 → 0 09:19:38 host asked property 101001 → 1 09:19:38 Initialize → 0 · in 2 ch @ 48000 Hz · out 2 ch 09:19:39 First render after 0s · input callback · tempo 120.00 Same build under our own manufacturer code EINX: "No render after 30s · host clock tempo+transport · flags 0". The request Could ACENTAUR (aumf / Acnt / EINX) be added to the set of plug-ins Logic keeps processing without input? The plug-in already answers the property in question; the only missing piece is on Logic's side. If there is a different or public mechanism you would prefer third parties to adopt (a component tag, an AU property, an AUv3 property), we will implement it right away. Happy to provide a build, a demo project and whatever else helps. Christoph Kahse, EINAUX
Replies
0
Boosts
0
Views
50
Activity
3d
macOS 27 regression: HDMI + DisplayPort Multi-Output audio fails with Core Audio error 1937010544
Hi, I believe I have found a Core Audio regression in macOS 27. This exact hardware configuration worked correctly on macOS 26, and the issue started immediately after upgrading to macOS 27. Hardware: Mac mini M2 2 × MSI MP243X monitors Monitor 1 connected via HDMI Monitor 2 connected via DisplayPort Both monitors expose a 2-channel audio output to macOS On macOS 26: I used Audio MIDI Setup to create a Multi-Output Device containing both MSI MP243X audio outputs. Audio played simultaneously through both monitors without any issues. On macOS 27: Both audio devices are still detected correctly and both work perfectly when selected individually: HDMI only: WORKS DisplayPort only: WORKS HDMI + DisplayPort simultaneously: FAILS This is reproducible even immediately after a full reboot. When I create a new Multi-Output Device containing both MSI outputs and select it as the system output, audio playback cannot start. For example: afplay /System/Library/Sounds/Glass.aiff returns: Error: AudioQueueStart failed ('stop') I captured Core Audio debug logs while reproducing the problem. Core Audio initially reports that StartIO succeeded, but the physical display audio device then fails to establish a timeline. Relevant log messages include: HALS_IOEngine2::_StartIO succeeded Device 3669B540-0000-0000-2623-0104A5351D78 is not running. could not establish a timeline after waiting 10000000 microseconds stopping with error 1937010544 StartIOThread: the IO thread failed to start, Error: 1937010544 I have already tested the following: Both devices at 44.1 kHz / 24-bit Both devices at 48 kHz / 16-bit Recreating the Multi-Output Device from scratch Using the HDMI device as clock source Using the DisplayPort device as clock source Different drift correction configurations Restarting coreaudiod Full macOS reboot Testing both outputs individually immediately after reboot Alternative multi-device audio routing software The behavior is always reproducible. Each MSI MP243X audio endpoint works correctly by itself. The failure only occurs when both HDMI and DisplayPort audio endpoints are opened simultaneously. system_profiler correctly detects both devices at 48 kHz: MSI MP243X Output Channels: 2 Current Sample Rate: 48000 Transport: HDMI MSI MP243X Output Channels: 2 Current Sample Rate: 48000 Transport: DisplayPort This does not appear to be a problem with either monitor or connection individually, because both outputs continue to work independently. The important difference is the macOS version: macOS 26: HDMI + DisplayPort Multi-Output = WORKING macOS 27: HDMI only = WORKING DisplayPort only = WORKING HDMI + DisplayPort Multi-Output = FAILS with AudioQueueStart 'stop' / Core Audio error 1937010544 No hardware, monitor, cable, or connection changes were made between the working macOS 26 configuration and the macOS 27 configuration. This therefore appears to be a regression in the Core Audio/display-audio path introduced with macOS 27 when two display audio endpoints (HDMI + DisplayPort) are opened simultaneously. Has anyone else been able to reproduce this on macOS 27, particularly on Apple Silicon? I can provide the complete coreaudiod logs and run additional Core Audio diagnostics if needed. Additional isolation tests: Both monitors can remain physically connected to the Mac at the same time. With both HDMI and DisplayPort connected: Selecting the HDMI MSI MP243X as the only output works correctly. Selecting the DisplayPort MSI MP243X as the only output works correctly. Opening both audio endpoints simultaneously causes the failure. Therefore, simply having both displays connected does not trigger the issue. The failure appears specifically when Core Audio attempts to run both display-audio endpoints at the same time. I also tested this using third-party multi-device audio routing implementations instead of relying only on Audio MIDI Setup. The same behavior occurs: either MSI MP243X can be opened and used independently, but attempting to route audio to both devices simultaneously fails. This suggests that the issue is below the Multi-Output Device configuration itself and may be related to starting/synchronizing two display-audio IO engines simultaneously. During the failure, the Core Audio log sequence is particularly interesting: The physical device is detected normally. The audio format is configured successfully. Core Audio reports that StartIO succeeded. The device subsequently reports that it is not running. Core Audio waits 10 seconds for a timeline. Timeline establishment fails. The IO thread terminates with error 1937010544 ('stop'). One captured conversion path was: 2 ch, 48000 Hz, Float32, interleaved -> 2 ch, 48000 Hz, Int16, interleaved so both sides were operating at 48 kHz during this test. Another important observation is that restarting coreaudiod does not resolve the simultaneous-output problem. A complete reboot also does not resolve it: immediately after a fresh boot, before launching any third-party audio-routing software, both physical outputs work individually but a newly created Multi-Output Device still reproduces the failure. This makes the issue highly reproducible on this machine. Minimal reproduction: Boot macOS 27 with both MSI MP243X monitors connected. Open Audio MIDI Setup. Verify both MSI MP243X devices work independently. Set both devices to 48,000 Hz. Create a new Multi-Output Device. Select both MSI MP243X devices. Select the new Multi-Output Device as the system audio output. Run: afplay /System/Library/Sounds/Glass.aiff Expected result: The sound is reproduced simultaneously through both monitors, as it was on macOS 26. Actual result: Error: AudioQueueStart failed ('stop') Switching the system output back to either individual MSI MP243X restores audio playback. The problem can then be reproduced again by selecting the Multi-Output Device.
Replies
6
Boosts
8
Views
2k
Activity
6d
AUv2: Property Listener Callback Lifetime During AudioComponentInstanceDispose
Title: AUv2: Property Listener Callback Lifetime During AudioComponentInstanceDispose I’m developing a macOS Audio Unit v2 (AUv2) instrument in C++ and investigating the correct lifetime and synchronization requirements for property-listener callbacks. I would appreciate clarification from Apple engineers or developers with direct AUv2 implementation experience. Specifically: Does AudioComponentInstanceDispose guarantee that the Audio Unit’s Close operation has completed before the call returns? Does disposal guarantee that all property-listener callbacks registered through AudioUnitAddPropertyListener have finished executing before the instance and its associated callback data can be destroyed? What are the documented guarantees of AudioUnitRemovePropertyListenerWithUserData regarding callbacks that are currently executing or already queued? Is there a documented synchronization procedure that allows an AUv2 plug-in to safely release listener callback state during instance shutdown? Are there host-ordering requirements or documented assumptions that plug-in developers must follow when registering, removing, and destroying property listeners? My implementation is designed to avoid use-after-free, concurrent access to destroyed objects, and unsafe callback-data reclamation. I want to base the implementation on documented Apple API guarantees rather than assumptions about host behaviour. If relevant, please point me to the authoritative documentation or recommended implementation pattern. Environment: macOS 12 Monterey, Xcode 14.2, AUv2 instrument, C++.
Replies
0
Boosts
0
Views
261
Activity
1w
macOS 27.2: second Bluetooth HFP microphone is silent despite two SCO connections
Hello Apple engineers and developers, My name is Fumikazu Kondo. I am an independent developer in Japan working on transcription applications, including KF Transcription Mixer. I want to capture two separately connected Bluetooth microphones on a Mac for meeting and conversation transcription. I would appreciate an Apple engineer's response about the supported behavior and a reliable solution. Problem Each microphone works when captured individually. When both are opened, the second input delivers only zeros, even though Core Audio starts successfully and macOS reports two SCO connections. The failure also reproduces with direct native Core Audio capture before any application audio processing. Environment MacBook Pro, Apple M5, model identifier Mac17,2 macOS 27.2; sw_vers reports build 26B123 Xcode 27.1 (27A9275), macOS 27.0 SDK Built-in Bluetooth controller: BCM_4388C2, firmware 24.2.241.1936 Microphones: Beats Pill (firmware 2C336) and SANWA SUPPLY MM-BTCL1 (firmware 1.0.0), both directly connected to the Mac Both input devices expose 16,000 Hz, mono. Bluetooth logs show HFP/mSBC. Microphone Mode: Standard; preferred and active values both read back as 0 Reproduction Connect both microphones to the Mac. Confirm each delivers real audio in a separate, fresh capture process. In Audio MIDI Setup, create an Aggregate Device with the two microphone input devices, one channel each. Use 16 kHz, one clock source, and drift correction for the other device. Start capture of the two channels. Use a controlled speech fixture played through the Mac's built-in speakers so that both microphones receive sound. Observe that one channel has audio and the other is entirely silent. I also reproduced the problem using AudioDeviceCreateIOProcID / AudioDeviceStart directly on the physical input devices, without an aggregate or application processing. Reversing their opening order changed which microphone remained silent: the later-opened device delivered zeros. Measured results Physical Mac XCTest runs on October 30, 2026: MM-BTCL1 alone: 203,520 captured frames; 232 nonzero observation windows; passed. Beats Pill alone: 203,520 captured frames; 233 nonzero observation windows; passed. Two-input aggregate: 202,240 frames; nonzero windows [240, 0]; simultaneous windows 0; application audio error 0. Separate native shared-clock experiment: an aggregate containing both microphone inputs plus the built-in speaker, driven by one full-duplex IOProc. 1,152 input callbacks and 1,152 output buffers; nonzero callback counts [1100, 0]; simultaneous windows 0; invalid samples 0. The last experiment rules out simply lacking a running output clock in the input-only capture path, but it did not fix the issue. Relevant system log messages include: Number of SCO Connections: 2. A2DP Streaming State: 0. Input Decode: Requested 640 bytes, but only read 0 bytes instead. Decoded a total of 0 bytesThe decode message repeats during the silent input. Successful voice-audio connection events appear for both devices. Device identifiers and unrelated logs are omitted here. Already tested Both microphones power-cycled and individually reconnected Mac restarted; issue reproduced afterward Standard microphone mode verified by readback Both microphones individually verified with the same controlled stimulus Reversed native device opening order Persistent and private aggregates; different clock choices and drift correction Direct physical-device IOProc capture Full-duplex shared-clock capture with the built-in speaker Built-in speaker selected as system output, with Bluetooth output streaming stopped during measurement Core Audio and Bluetooth services restarted; issue persisted Software Update reports no new software available I have not established whether the cause is in the OS, driver, controller, or device firmware. I am not claiming a universal Bluetooth specification limitation. Questions for Apple Is simultaneous capture from two directly connected HFP/mSBC microphones supported on this Mac/macOS configuration through Core Audio? If there is a limitation, could you provide the relevant documentation and clarify its scope? If supported, which public API or configuration should be used to keep both input streams delivering audio? Is there a known issue or supported workaround for the all-zero second stream? Which targeted Bluetooth/HCI logs or minimal reproduction details would Apple need to investigate? I can provide a focused reproduction and redacted measurements through an appropriate private channel if needed. This is blocking reliable two-microphone transcription. Please respond with the expected behavior, next diagnostic steps, or the appropriate Apple engineering support route. Thank you for your help. Update: also reproduced with two Beats Pill speakers On October 30, 2026, I replaced the MM-BTCL1 with a second Beats Pill. Both Beats Pill speakers report firmware 2C336 and are independently connected to this Mac. Microphone Mode remains Standard (0). Fresh individual controls after previous SCO connections fully disconnected: both work (235 and 236 nonzero observation windows). Application-created private aggregate, device order A/B: nonzero windows [233, 0]. Reversed participant order: [0, 240]. Direct physical-device IOProc test, opening A before B: callback counts [404, 402], but nonzero callback counts [403, 0]. No simultaneous audio windows. After releasing both and restarting B alone, B delivers audio (381 nonzero callbacks). Opening A while B continues then yields nonzero counts [0, 404]: the later-opened device is again silent. System logs again report two SCO connections and repeated zero-byte input decode messages. Thus the same failure also reproduces with two same-model, same-firmware Apple/Beats devices. Please include this configuration when assessing support status, a possible known issue, and recommended next steps. Additional comparison reported by the user: the MacBook built-in microphone and one Beats Pill can both be heard when used together. This is a user-observed working configuration, separate from the automated tests above. It further narrows the problem to the configuration with two simultaneous Bluetooth microphone inputs.
Replies
0
Boosts
0
Views
226
Activity
1w
Using Apple Music API artist artwork and library import on a music rating website
Hi all, We run Soundmark, a small UK website where people rate and review albums and songs (web only for now, a native app may come later). We'd like to use the Apple Music API in two ways, and want to make sure we stay within the rules before building anything: Show artist images on our artist pages. Let users connect their Apple Music account and import their library, so the albums and songs they already have show up on Soundmark ready to rate. Our setup today: Album and song pages have a small player that plays 30-second previews. On desktop, some pages also show the Spotify embed player. There are no ads on the site. We would show the Apple Music badge and a link to Apple Music alongside any Apple content, following the Apple Music Identity Guidelines. Our questions: Can a website use artist artwork from the Apple Music API if it only plays 30-second previews, or does it need full MusicKit on the web playback (users connecting their Apple Music account)? Can the artist image appear on a page that also shows a Spotify embed player, or does it need to be on pages with Apple Music playback only? Beyond Apple's own terms, do we need separate permission from rights-holders to display artist images, or is the API licence enough when used as described? Can we import catalog data (album and song titles, tracklists, release dates and cover art) from the Apple Music API and store it permanently in our own database, so our album and song pages are built from it? Can those pages be shown to everyone, including visitors without an Apple Music account, and are there limits on caching cover art or on how many albums we import (rate limits)? We also emailed Apple Developer Support on 21st October and chased on the 28th but haven't heard back yet, so any pointers to the relevant terms would be really appreciated. Thanks!
Replies
0
Boosts
0
Views
73
Activity
1w
Supported integration path for two-deck Apple Music DJ playback on iPhone, iPad and Mac Catalyst
We develop SpinCut DJ, a free-to-download proprietary DJ application by LALAMO CORPORATION for iPhone, iPad and Mac Catalyst. We want to add Apple Music subscription playback for users with an active subscription, similar to the integrations featured in DJ with Apple Music. This question is about the officially supported integration path, not extracting or bypassing protected audio. Our existing engine uses app-owned PCM for two independently controlled decks, scratch/reverse playback, tempo changes, hot cues, loops, beat synchronization and independent master/headphone outputs. We have reviewed MusicAuthorization, MusicSubscription, catalog/library requests, ApplicationMusicPlayer and SystemMusicPlayer. We understand that ordinary catalog access and protected queue playback do not establish a documented route to feed subscription audio into our custom engine, or permission to modify or synchronize MusicKit content. We have not enabled subscription-catalog DJ playback. Apple Developer Support advised us to ask the Developer Forums about the required technical integration. Could an Apple representative clarify: Is there a documented public API for two independent, simultaneous Apple Music DJ decks with scratch/reverse/tempo control? If a separate Apple Music DJ integration, agreement, SDK or capability is required, what is the current official application or referral process for a Japan-based developer? Are iOS, iPadOS and Mac Catalyst supported through the same integration, and what technical material is required for evaluation? What approved interfaces govern waveform/beat analysis, seeking and separate master/headphone routing? We are not requesting recording/export, stem separation, offline file extraction or rebroadcast permission through ordinary MusicKit. Those features would remain unavailable for subscription content unless separately and expressly supported. We can provide a product demonstration and integration brief through an appropriate private channel. Product: https://spincutdj.com/ App Store: https://apps.apple.com/app/id6804328893 Please point us to the supported technical and onboarding path rather than an undocumented entitlement or workaround.
Replies
0
Boosts
0
Views
279
Activity
1w
TTS Stuttering & Noise
TTS Stuttering & Noise When using Apple’s native TTS API on an iPhone or iPad—specifically while connected to Bluetooth earphones or headsets—users are experiencing audio noise or intermittent gaps in speech, causing parts of sentences to drop out during playback. There were no reports or inquiries regarding such issues up through iOS/iPadOS 26. Since the release of iOS/iPadOS 27, however, there has been a significant increase in reports and inquiries about this problem. If you happen to know the cause of this issue or have any suggestions for a fix, please leave a reply. The issue persists even after removing the AirPods or headset from the device and reconnecting them. The issue persists even after rebooting the device. The issue occurs even on the latest versions, from iOS/iPadOS 27 through 27.2.
Replies
0
Boosts
0
Views
89
Activity
1w
Title: MusicKit Web v3 authorize() fails with AUTHORIZATION_ERROR after Allow — Windows Chrome/Edge (FB25267497)
Hello Apple engineers and fellow developers, I am developing CloudMusic Bridge, a Windows desktop music application integrating the official MusicKit Web v3 SDK. MusicKit initialization succeeds, but authorize() consistently rejects with AUTHORIZATION_ERROR after the user clicks Allow in Apple's official authorization window. Environment Windows, Google Chrome and Microsoft Edge MusicKit Web v3 from Apple's official CDN Local HTTPS origin: https://localhost:4318 Valid ES256 developer token with a matching origin claim MusicKit-enabled Media ID and associated Media Services key Active Apple Music subscription, with full-song playback working on music.apple.com Catalog API requests succeed (HTTP 200) Actual MusicKit SDK build: UNKNOWN Reproduction I created a standalone minimal reproduction that loads MusicKit, initializes it, obtains the instance and invokes instance.authorize() directly from a user click. The user signs in and clicks Allow, but the authorization Promise rejects. I also tested a separate page that explicitly allows https://play.itunes.apple.com in both CSP connect-src policies. This eliminated the previously observed document CSP violations during the comparison, but authorization still failed with AUTHORIZATION_ERROR after approximately 46.6 seconds. The application did not reach its 120-second timeout. Questions for Apple DTS How can I verify that my browser is loading the current supported stable MusicKit Web v3 build? Is there any additional developer configuration required for web authorization? How can I safely identify the underlying authorization exchange failure? Since this reproduces on Windows, what diagnostics should I provide instead of macOS sysdiagnose? Could an Apple engineer help investigate my existing report, FB25267497? I have already contacted Apple Developer Support and was directed to the Developer Forums for SDK-related technical assistance. I can provide a sanitized minimal reproduction and diagnostic timeline. Thank you for your help.
Replies
2
Boosts
0
Views
392
Activity
1w
AVAudioSession ioBufferDuration always default to 512 samples on MacOS27 no matter what is requested
Hello, I develop an audio processing demo app that has been working fine on iOS/iPad and on Mac ("developed for iPad") until I upgraded to MacOS27. The app is demonstrating low latency / high temporal resolution audio spectral analysis. I am using AVAudioSession, I request the audio IO buffer to be 32 samples. This still works fine on iOS/iPadOS, but it seems that when running on MacOS27 the buffer size always defaults to 512 samples no matter what I request (smaller or larger). This applies to the "Designed for iPad" version running on MacOS and any version running in the iPhone and iPad simulators on MacOS. The app seems to be working as intended on physical iPhones and iPads. I made a catalyst version and used AudioObjectSetPropertyData to force the IO bugger sizes to 32 samples on the system's active hardware device. This seems to succeed but still results in incorrect behaviour in my app; I am still diagnosing but I believe it's because this leaves AVAudioSession with incorrect data, and I am using AudioKit which relies on AVAudioSession (not confirmed). Regardless, is this change in behaviour intentional in MacOS27? Is there a way around it? The whole point of my app is to demonstrate efficient audio processing with very low latency - I need small input buffer size for that. Thank you for any help with this
Replies
1
Boosts
0
Views
334
Activity
1w
Is there a supported API to open a computer-synced album’s Library page in Music on iOS?
I’m building a personal iPhone app that organizes my music library. When I tap an album in my app, I want Apple’s Music app to open directly to that album’s page in Library, showing the tracks synced from my computer. My app can already read the albums and their tracks using MusicKit. I’ve tried normal Apple Music sharing links, but those open the catalog version of the album. I need the page I see when I find the album through Library in the Music app. Starting or changing playback is fine, but the album page must appear. Only starting the music or opening Now Playing would not be enough. Is there a supported API or link format that can do this? A documentation link or a small code example would be helpful.
Replies
1
Boosts
0
Views
266
Activity
1w
CABTMIDICentralViewController in SwiftUI broken on iOS 27
When wrapping CABTMIDICentralViewController in a UIViewControllerRepresentable and presenting modally, I experience layout crashes since iOS 27. Does anyone have a workaround? import SwiftUI import CoreAudioKit struct BluetoothButton: View { @State var showsBluetooth = false let title = "Check for Bluetooth MIDI Devices" var body: some View { #if os(macOS) Button { let wc = CABTLEMIDIWindowController() wc.showWindow(nil) } label: { label } #else Button { showsBluetooth = true } label: { label } .sheet(isPresented: $showsBluetooth) { BluetoothCentralView() } #endif } var label: some View { Text(title) } } #if os(iOS) struct BluetoothCentralView: UIViewControllerRepresentable { func makeUIViewController(context: Context) -> CABTMIDICentralViewController { return CABTMIDICentralViewController() } func updateUIViewController(_ uiViewController: CABTMIDICentralViewController, context: Context) { } } #endif
Replies
7
Boosts
0
Views
1.5k
Activity
1w
MusicKit tvOS — Some personal library songs fail with Error Code 6, while others play successfully
Hi everyone, I’m developing a native Apple TV application using MusicKit for Swift. The app provides a custom interface for browsing and playing the user’s personal Apple Music library. The application was working correctly for several months, but recently certain songs from the user’s personal library have stopped playing. I’ve been investigating this issue extensively and have reproduced it in a completely separate, minimal tvOS test application. The issue I retrieve songs using MusicLibraryRequest() and play them using ApplicationMusicPlayer. Some songs play successfully, while others consistently fail during playback preparation with: `MPMusicPlayerControllerErrorDomain Code=6 "Prepare to play failed"` The underlying errors include : NSCocoaErrorDomain Code=4099 Example of a failing song Michael Jackson — Bad (2012 Remaster) Library song ID: i.ldDOAp0UrAa62J Successfully retrieved using MusicLibraryRequest() Fails when queued with ApplicationMusicPlayer Also fails with SystemMusicPlayer Example of a working song Harry Nilsson — Everybody’s Talkin’ (1971 Mix) Library song ID: i.WmYQp9PcdZ4Y0E Retrieved using the exact same MusicLibraryRequest() Successfully plays using ApplicationMusicPlayer Both songs have library identifiers beginning with i.. What I’ve tested ApplicationMusicPlayer with prepareToPlay() followed by play(). SystemMusicPlayer with the same library song. Direct play() without explicitly calling prepareToPlay(). Retrieving songs directly using MusicLibraryRequest(), rather than accessing them through albums. A completely separate minimal tvOS application. An older version of my application’s code, recompiled using the current Xcode version. The issue persists across these tests. Interestingly, the corresponding Apple Music catalog song plays successfully when retrieved through MusicCatalogSearchRequest. However, replacing library songs with catalog equivalents is not an acceptable solution because the application needs to support users’ actual personal libraries, including imported music. Important observation The exact same failing song plays correctly on the same Apple TV and Apple Music account in: The official Apple Music application. Sleeve, another third-party Apple TV music player. This suggests that the song itself is playable and that another third-party application can successfully initiate playback. Environment Platform: tvOS Device: Physical Apple TV Framework: MusicKit for Swift Apple Music authorization: Granted MusicKit App Service: Enabled Signing: Automatic, using a paid Apple Developer account Question Is there a known issue with resolving or playing certain personal library songs through MusicKit on tvOS? Are there additional playback parameters, library synchronization requirements, or recommended queue configurations that could explain why some MusicLibraryRequest() items fail while others work? Has anyone encountered a similar issue or found a workaround that preserves playback of the user’s actual library items? Any guidance would be greatly appreciated. Thank you!
Replies
2
Boosts
0
Views
506
Activity
1w
AVAudioSession blocks 20–36s on A2DP→HFP switch while another AudioUnit is rendering (iOS 27.0.1, AirPods Spatial Audio)
While an AVAudioPlayer/AudioUnit is rendering to AirPods over A2DP with system Spatial Audio + Head Tracking enabled, switching the shared AVAudioSession to playAndRecord + voiceChat (A2DP → HFP) blocks the main thread for tens of seconds on synchronous AVAudioSession APIs (setCategory / setMode / channel getters / setPreferred*). iOS hang detection reports a Severe Hang of 41.02 s. Stopping playback and deactivating the session before the identical switch completes in ~87 ms. Feedback: FB25324099 Environment iPhone 15 Pro (iPhone16,1), iOS 27.0.1 (24A446) AirPods worn; Spatial Audio + Head Tracking on AVFoundation-only repro (no third-party SDK): https://github.com/shinobuwz/ios27-spatial-audio-stall-repro Info.plist: LSApplicationCategoryType = public.app-category.games, LSSupportsGameMode = YES; does NOT set AVGameBypassSystemSpatialAudio (those two keys are required for system Spatial Audio on this path) Steps Wear AirPods with Spatial Audio + Head Tracking enabled Launch the repro app; allow mic (or use auto-repro) Play 440 Hz (BluetoothA2DP, spatial=1) After ~2 s, run Repro: keep playing and switch to PlayAndRecord + VoiceChat Compare with Control: stop playback + setActive:NO, then the same switch Expected: each call returns in ms; whole reconfiguration ≪ 50 ms Actual (cold launches): configuration total 20.8–28.9 s (options=13); with options=237 ≈ 36.2 s; first input buffer ~40–58 s from switch start. Control ≈ 87 ms. Evidence in the repo: docs/MEASUREMENTS-2026-10-26.md, evidence/*.log, hangs.xml, main-thread stacks in avas::client::SessionCore (sync XPC to the audio daemon). Even inputNumberOfChannels / outputNumberOfChannels getters stall for seconds. Question: Is this a known regression on iOS 27? Any workaround besides stopping all rendering AudioUnits before the HFP switch? Happy to attach sysdiagnose / Instruments / screen recording if useful.
Replies
0
Boosts
0
Views
452
Activity
1w
Can third-party apps access Apple Music concert listings?
I’m developing Segue, an iPhone and Apple Watch app for discovering concerts and keeping personal concert memories. Apple Music artist pages display upcoming concerts, including dates, venues, lineups, and ticket links. I would like users to search for an artist and view those concerts directly within Segue. Is there a supported public API or Apple framework for accessing these concert listings? I reviewed MusicKit and Apple Music API documentation but couldn’t find concert-related endpoints. Example Apple Music concert: https://music.apple.com/us/concerts/ce.91c8bd7d-0669-4c33-8c2a-6809b9f65129 If this requires separate partner access or approval, could you direct me to the appropriate team?
Replies
0
Boosts
0
Views
149
Activity
1w
SFSpeechRecognizer is unavailable or fails to initialize on iOS 26.4 and 26.5 Simulators
I am testing SFSpeechRecognizer using the en_US locale. When the iPhone Simulator’s system language is set to Japanese, SFSpeechRecognizer.isAvailable returns false for en_US, so speech recognition is unavailable. As far as I have tested, this issue does not occur on iOS Simulator 26.2 or earlier. Is this a Simulator-specific issue, or is it a behavior change that could also occur on physical devices? Has any additional setup become necessary to use speech recognition in Simulator? I then changed the iPhone Simulator’s system language to English. After doing so, SFSpeechRecognizer.isAvailable returned true for en_US. However, starting a recognition task still failed immediately with kLSRErrorDomain Code=300, “Failed to initialize recognizer.” The following error was returned: Error Domain=kLSRErrorDomain Code=300 "Failed to initialize recognizer" UserInfo={ NSLocalizedDescription=Failed to initialize recognizer, NSUnderlyingError={ Error Domain=kLSRErrorDomain Code=300 "Failed to create recognizer from=/Users/<USERNAME>/Library/Developer/CoreSimulator/Devices/<DEVICE-UUID>/data/private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_UAF_Siri_Understanding/purpose_auto/ c079bfa6b8856202dc8cb2135fef3b06229ced6e.asset/AssetData/mini.json" UserInfo={ NSLocalizedDescription=Failed to create recognizer from=/Users/<USERNAME>/Library/Developer/CoreSimulator/Devices/<DEVICE-UUID>/data/private/var/MobileAsset/AssetsV2/com_apple_MobileAsset_UAF_Siri_Understanding/purpose_auto/ c079bfa6b8856202dc8cb2135fef3b06229ced6e.asset/AssetData/mini.json } } } I have not observed either of these issues on iOS Simulator 26.2 or earlier: With the Simulator language set to Japanese, the en_US recognizer does not become unavailable. When SFSpeechRecognizer.isAvailable is true, recognition does not fail with kLSRErrorDomain Code=300. Environment Xcode: 26.6 (17F113) iOS Simulator 26.5 (23F77), iPhone 17 (A3258J/A) iOS Simulator 26.4 (23E244), iPhone 17 (A3258J/A)
Replies
1
Boosts
1
Views
1.9k
Activity
2w
AVAudioRecorder loses earlier audio after Siri with iOS 27 lifecycle notifications
I’m migrating to the new notifications described in Handling audio interruptions. On an iPhone 14 running iOS 27.0.1 (24A446), I call pause() when the system deactivates the session. On .shouldResume, I await successful session.activate() and call record() on the same recorder. It returns true, but the saved file contains only the audio recorded after Siri. To reproduce: record for five seconds, invoke and dismiss Siri, record for another five seconds, then stop and play. The earlier five seconds are missing. A legacy-notification control preserved both portions on the same phone. Is another step required to preserve the recording with the new notifications, or is this a known issue? I found this similar report, although it uses the legacy API. Minimal reproduction Built with Xcode 27.1. Create a SwiftUI iOS app targeting iOS 27, replace its generated App.swift with the code below, and add these Info.plist entries: NSMicrophoneUsageDescription: Test audio recording UIBackgroundModes: an array containing audio import SwiftUI import AVFoundation @main struct RecorderReproApp: App { var body: some Scene { WindowGroup { RecorderReproView() } } } @MainActor struct RecorderReproView: View { private let session = AVAudioSession.sharedInstance() private let file = URL.documentsDirectory.appendingPathComponent("recording.m4a") @State private var recorder: AVAudioRecorder? @State private var player: AVAudioPlayer? @State private var running = false @State private var interrupted = false @State private var status = "Ready" var body: some View { VStack(spacing: 24) { Button("Start") { Task { await start() } }.disabled(running) Button("Stop") { running = false interrupted = false recorder?.stop() status = file.path }.disabled(!running) Button("Play") { do { player = try AVAudioPlayer(contentsOf: file) status = "Saved duration: \(player!.duration) seconds" player?.play() } catch { status = error.localizedDescription } }.disabled(running) Text(status) } .padding() .task { for await notification in NotificationCenter.default.notifications( named: AVAudioSession.didBecomeInactiveNotification, object: session ) { guard running, let context = notification.userInfo?[AVAudioSession.deactivationContextKey] as? AVAudioSession.DeactivationContext, context.source == .system else { continue } recorder?.pause() interrupted = true status = "Interrupted" } } .task { for await notification in NotificationCenter.default.notifications( named: AVAudioSession.resumptionRecommendationNotification, object: session ) { guard running, interrupted, let context = notification.userInfo?[AVAudioSession.resumptionContextKey] as? AVAudioSession.ResumptionContext else { continue } guard context.recommendation == .shouldResume else { interrupted = false continue } do { guard try await session.activate(), running, interrupted else { continue } status = "Resumed: \(recorder!.record())" interrupted = false } catch { status = error.localizedDescription } } } } private func start() async { guard await AVAudioApplication.requestRecordPermission() else { return } do { try session.setCategory(.playAndRecord) guard try await session.activate() else { return } recorder = try AVAudioRecorder(url: file, settings: [ AVFormatIDKey: kAudioFormatMPEG4AAC_HE, AVSampleRateKey: 44_100, AVEncoderBitRateKey: 32_000, AVNumberOfChannelsKey: 2 ]) running = recorder!.record() status = "Recording: \(running)" } catch { status = error.localizedDescription } } }
Replies
0
Boosts
0
Views
476
Activity
2w