<!--
{
  "availability" : [
    "iOS: 4.2.0 - 27.0.0",
    "iPadOS: 4.2.0 - 27.0.0",
    "macCatalyst: 13.1.0 - 27.0.0",
    "macOS: 10.0.0 - 27.0.0",
    "visionOS: 1.0.0 - 27.0.0"
  ],
  "documentType" : "symbol",
  "framework" : "CoreMIDI",
  "identifier" : "/documentation/CoreMIDI/MIDIInputPortCreate(_:_:_:_:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Function",
  "symbol" : {
    "kind" : "Function",
    "modules" : [
      "Core MIDI"
    ],
    "preciseIdentifier" : "c:@F@MIDIInputPortCreate"
  },
  "title" : "MIDIInputPortCreate(_:_:_:_:_:)"
}
-->

# MIDIInputPortCreate(_:_:_:_:_:)

Creates an input port through which the client may receive incoming MIDI messages from any MIDI source.

```
func MIDIInputPortCreate(_ client: MIDIClientRef, _ portName: CFString, _ readProc: MIDIReadProc, _ refCon: UnsafeMutableRawPointer?, _ outPort: UnsafeMutablePointer<MIDIPortRef>) -> OSStatus
```

## Parameters

`client`

The client to own the newly-created port.

`portName`

The name of the port.

`readProc`

The MIDIReadProc which will be called with incoming MIDI, from sources connected to this port.

`refCon`

The refCon passed to readHook.

`outPort`

On successful return, points to the newly-created MIDIPort.

## Return Value

An OSStatus result code.

## Discussion

After creating a port, use MIDIPortConnectSource to establish an input connection from any number of sources to your port.

readProc will be called on a separate high-priority thread owned by CoreMIDI.

---

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)