<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: -",
    "macOS: 27.0.0 -",
    "tvOS: 27.0.0 -",
    "visionOS: 27.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MusicUnderstanding",
  "identifier" : "/documentation/MusicUnderstanding/KeyResult",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Music Understanding"
    ],
    "preciseIdentifier" : "s:18MusicUnderstanding9KeyResultV"
  },
  "title" : "KeyResult"
}
-->

# KeyResult

A value describing the musical key detected over a time range.

```
struct KeyResult
```

## Overview

A key is the central note that organizes a piece of music. The tonic can be any of the supported enharmonic spellings: A, A♭, A♯, B♭, B, C, C♯, D♭, D, D♯, E♭, E, F, F♯, G, G♭, or G♯. The framework represents the enharmonic equivalents as distinct cases to preserve the original spelling.

## Topics

### Getting key result ranges

[`let ranges: [MusicUnderstandingSession.RangedValue<KeyResult.KeySignature>]`](/documentation/MusicUnderstanding/KeyResult/ranges)

The detected key for each time range.

### Getting the mode of the musical key

[`let mode: KeyResult.Mode`](/documentation/MusicUnderstanding/KeyResult/KeySignature/mode)

The mode of the musical key.

### Getting the notes of a key

[`struct KeySignature`](/documentation/MusicUnderstanding/KeyResult/KeySignature)

The set of sharp and flat symbols for the notes.

[`let tonic: KeyResult.Tonic`](/documentation/MusicUnderstanding/KeyResult/KeySignature/tonic)

The root note of the musical key.

### Enumerations

[`enum Mode`](/documentation/MusicUnderstanding/KeyResult/Mode)

The mode of a musical key.

[`enum Tonic`](/documentation/MusicUnderstanding/KeyResult/Tonic)

The root note of a musical key.

## Relationships

### Conforms To

[`Sendable`](/documentation/Swift/Sendable)

[`Encodable`](/documentation/Swift/Encodable)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`Decodable`](/documentation/Swift/Decodable)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)