One Logo Pool Ball
MusicUnderstanding · IOS API REFERENCE

MusicUnderstandingSession

class · iOS 27.0+ · SDK 27.1

actor MusicUnderstandingSession

An object that performs music analysis on an audio source and provides the results.

Members (6)

get · iOS 27.0+

loudnessResults

TypeScript
get loudnessResults(): (SDKHandle) & (SDKHandle)
Swift declaration
nonisolated var loudnessResults: some Sendable & AsyncSequence<LoudnessResult, any Error> { get }

An async sequence that yields loudness analysis results as they become available.

get · iOS 27.0+

unownedExecutor

TypeScript
get unownedExecutor(): SDKHandle
Swift declaration
nonisolated final var unownedExecutor: UnownedSerialExecutor { get }

Retrieve the executor for this actor as an optimized, unowned reference. This property must always evaluate to the same executor for a given actor instance, and holding on to the actor must keep the executor alive. This property will be implicitly accessed when work needs to be scheduled onto this actor. These accesses may be merged, eliminated, and rearranged with other work, and they may even be introduced when not strictly required. Visible side effects are therefore strongly discouraged within this property. - SeeAlso: ``SerialExecutor`` - SeeAlso: ``TaskExecutor``

init · iOS 27.0+

init

TypeScript
static init(asset: (_AVFoundation_AVAsset) & (SDKHandle)): Promise<MusicUnderstandingSession>
Swift declaration
convenience init(asset: any AVAsset & Sendable) async throws

Creates a music understanding session from an audio asset. Use this initializer when your audio source is an AVAsset rather than a streaming sequence of audio buffers. - Parameter asset: An `AVAsset` containing an audio track. - Throws: If the asset is unreadable, does not contain valid audio tracks, has protected content, or cannot be processed for analysis. - Note: This initializer does not support HTTP live streams (HLS). The asset must represent locally available media or a complete file.

method · iOS 27.0+

cancel

TypeScript
cancel(): Promise<void>
Swift declaration
func cancel() async

Cancels any ongoing analysis. Once a session has been canceled it cannot be re-used.

method · iOS 27.0+

analyze

TypeScript
analyzeFor(analysisTypes: Array<AnalysisType>): Promise<MusicUnderstandingSession_SessionResult>
Swift declaration
@discardableResult func analyze(for analysisTypes: Set<AnalysisType>) async throws -> MusicUnderstandingSession.SessionResult

Performs the specified analyses on the session's audio source. - Parameter analysisTypes: A `Set` of `AnalysisType` values specifying which analyses to perform. - Returns: The aggregated session result containing all requested analyses. - Throws: If the analysis types set is empty, or if analysis is already running on this session. - Note: Call this method only once per session instance. Create a new session to run additional analyses. Example usage: ```swift let session = MusicUnderstandingSession(audioProvider: provider) let result = try await session.analyze(for: [.rhythm, .pace, .loudness]) ```

method · iOS 27.0+

analyze

TypeScript
analyze(): Promise<MusicUnderstandingSession_SessionResult>
Swift declaration
@discardableResult func analyze() async throws -> MusicUnderstandingSession.SessionResult

Performs all available analyses on the session's audio source. - Returns: The aggregated session result containing all analyses. - Throws: If analysis is already running on this session. - Note: This method can only be called once per session instance. Create a new session to run additional analyses. Example usage: ```swift let session = MusicUnderstandingSession(audioProvider: provider) let result = try await session.analyze() ```

Skipped declarations

1 declarations were excluded from these bindings. Each reason comes from the generator or the iOS SDK compiler.

MusicUnderstandingSession.init(audioProvider:)

This declaration needs Swift generic type arguments. (no canonical witness for Provider)

All MusicUnderstanding types →