<!--
{
  "availability" : [
    "iOS: 16.0.0 -",
    "iPadOS: 16.0.0 -",
    "macCatalyst: 16.0.0 -",
    "macOS: 13.0.0 -",
    "tvOS: 16.0.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "AVFAudio",
  "identifier" : "/documentation/AVFAudio/AVMIDINoteEvent",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AVFAudio"
    ],
    "preciseIdentifier" : "c:objc(cs)AVMIDINoteEvent"
  },
  "title" : "AVMIDINoteEvent"
}
-->

# AVMIDINoteEvent

An object that represents MIDI note on or off messages.

```
class AVMIDINoteEvent
```

## Topics

### Creating a MIDI Note Event

[`-  initWithChannel:key:velocity:duration:`](/documentation/AVFAudio/AVMIDINoteEvent/init(channel:key:velocity:duration:))

Creates an event with a MIDI channel, key number, velocity, and duration.

### Configuring a MIDI Note Event

[`channel`](/documentation/AVFAudio/AVMIDINoteEvent/channel)

The MIDI channel.

[`key`](/documentation/AVFAudio/AVMIDINoteEvent/key)

The MIDI key number.

[`velocity`](/documentation/AVFAudio/AVMIDINoteEvent/velocity)

The MIDI velocity.

[`duration`](/documentation/AVFAudio/AVMIDINoteEvent/duration)

The duration for the note, in beats.

## Relationships

### Conforms To

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

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

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

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

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

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

### Inherits From

[`AVMusicEvent`](/documentation/AVFAudio/AVMusicEvent)

---

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)