aud_midi_network library

Network MIDI sessions in pure Dart: AppleMIDI (RTP-MIDI) and Network MIDI 2.0 over UDP, mDNS browsing, a backend that turns connections into ports, and a lossy UDP proxy for tests.

Classes

MidiAppleMidiBitrateLimit
RL: asks the sender to stay below a bit rate, e.g. for a gateway to a MIDI 1.0 DIN cable.
MidiAppleMidiClockSync
Estimates the offset between the session clocks of two AppleMIDI participants from CK exchanges, with outlier and drift filtering.
MidiAppleMidiCommand
A command of the AppleMIDI session protocol, the session layer Apple's network MIDI driver puts on top of RTP-MIDI (RFC 6295).
MidiAppleMidiConnection
An AppleMIDI session with one peer: the session protocol of Apple's network MIDI driver around an RTP-MIDI stream (RFC 6295) in each direction.
MidiAppleMidiEndSession
BY: ends the session; either participant may send it.
MidiAppleMidiInvitation
IN: invites the receiver into a session; sent by the initiator first to the control port, then to the data port.
MidiAppleMidiInvitationAccepted
OK: accepts an invitation; repeats the initiator token.
MidiAppleMidiInvitationRejected
NO: rejects an invitation; repeats the initiator token.
MidiAppleMidiReceiverFeedback
RS: tells the sender of RTP data up to which sequence number the receiver got the stream, so the sender can shorten its recovery journal.
MidiAppleMidiSession
An AppleMIDI session: the network MIDI session of Apple's driver in pure Dart, on a control port and the data port right above it.
MidiAppleMidiSessionCommand
The base of IN, OK, NO and BY: the commands that open and close a session.
MidiAppleMidiSettings
The timing of AppleMIDI sessions.
MidiAppleMidiSync
CK: one step of the three-way clock synchronisation.
MidiLossyUdpProxy
A UDP proxy for tests that forwards datagrams between clients and a target over an impaired link: loss, burst loss, reordering, duplication and delay, all drawn from a seeded random generator.
MidiNetworkAccess
Decides which peers may connect to a session.
MidiNetworkBrowser
Finds network MIDI sessions on the local network with multicast DNS queries (DNS-SD, RFC 6763): the PTR records of a service type name the instances, their SRV records the host and port, and the A or AAAA records of the host its address.
MidiNetworkConnection
A connection of a network MIDI session to one remote peer.
MidiNetworkConnectionListener
Receives what happens on the connections of a session; sessions implement it and pass it to their connections.
MidiNetworkImpairment
How an unreliable link treats datagrams: random and burst loss, duplication, reordering and delay.
MidiNetworkMidi2AuthenticationRequired
Invitation Reply: Authentication Required (0x12): the host challenges the client to prove the shared secret.
MidiNetworkMidi2Bye
Bye (0xF0): ends a session or refuses an invitation.
MidiNetworkMidi2ByeReply
Bye Reply (0xF1): confirms a bye.
MidiNetworkMidi2Command
A command packet of Network MIDI 2.0 (UDP), MIDI Association document M2-124-UM.
MidiNetworkMidi2Connection
A Network MIDI 2.0 session with one peer (M2-124-UM 6 and 7), in the client role when this side invites and in the host role when the peer does.
MidiNetworkMidi2Credentials
The credentials a Network MIDI 2.0 client proves to a host that asks for authentication (M2-124-UM 6.9 and 6.10).
MidiNetworkMidi2InvalidCommand
A command packet that could not be decoded; receivers answer it with a NAK.
MidiNetworkMidi2Invitation
Invitation (0x01): a client asks a host for a session.
MidiNetworkMidi2InvitationAccepted
Invitation Reply: Accepted (0x10): the session is established.
MidiNetworkMidi2InvitationPending
Invitation Reply: Pending (0x11): the host needs time, e.g. for a user to approve the client; the client waits instead of inviting again.
MidiNetworkMidi2InvitationReply
The base of the four replies a host sends to an invitation; all carry the host's UMP Endpoint Name and Product Instance Id.
MidiNetworkMidi2InvitationWithAuthentication
Invitation with Authentication (0x02): a client answers a challenge with the digest of the nonce and the shared secret.
MidiNetworkMidi2InvitationWithUserAuthentication
Invitation with User Authentication (0x03): a client answers a challenge with the digest of the nonce, user name and password, and the user name.
MidiNetworkMidi2Nak
NAK (0x8F): refuses a command.
MidiNetworkMidi2Ping
Session Ping (0x20): checks that the remote is alive and measures the round trip.
MidiNetworkMidi2PingReply
Session Ping Reply (0x21): answers a ping.
MidiNetworkMidi2RetransmitError
Retransmit Error (0x81): the requested commands cannot be sent again.
MidiNetworkMidi2RetransmitRequest
Retransmit Request (0x80): asks for UMP Data commands again.
MidiNetworkMidi2Session
A Network MIDI 2.0 (UDP) endpoint (M2-124-UM): one UDP port that hosts sessions for clients and opens sessions to other hosts as a client.
MidiNetworkMidi2SessionReset
Session Reset (0x82): both sides start their sequence numbers at 0 again.
MidiNetworkMidi2SessionResetReply
Session Reset Reply (0x83): confirms a reset.
MidiNetworkMidi2Settings
The timing and buffering of Network MIDI 2.0 sessions (M2-124-UM).
MidiNetworkMidi2SharedSecret
A secret shared by the host and its clients (Invitation with Authentication).
MidiNetworkMidi2UmpData
UMP Data (0xFF): complete Universal MIDI Packets with a 16-bit sequence number; without words it is a keep-alive that still advances the sequence.
MidiNetworkMidi2UnknownCommand
A command with a code this implementation does not know; receivers answer it with a NAK.
MidiNetworkMidi2UserAuthenticationRequired
Invitation Reply: User Authentication Required (0x13): the host challenges the client to prove a user name and password.
MidiNetworkMidi2UserCredentials
A user name and password (Invitation with User Authentication).
MidiNetworkSession
A network MIDI session run by this package: a local endpoint on UDP that accepts connections from peers and opens connections to hosts.
MidiNetworkSessionBackend
A backend that runs a network MIDI session of this package and turns each of its connections into an input and an output port.
MidiNetworkSessionEvents
Turns the reports of a session's connections into the session's streams; sessions hold one and hand it to their connections.

Functions

midiBindAdjacent({required InternetAddress address, required int count, int firstPort = 0, int attempts = 20, Future<RawDatagramSocket> bind(dynamic address, int port) = RawDatagramSocket.bind}) → Future<List<RawDatagramSocket>>
Binds count UDP sockets on adjacent ports of address, e.g. the control and the data port of an AppleMIDI session.

Typedefs

MidiNetworkLoss = ({String cause, MidiNetworkConnection connection, int count})
Packets of a connection of a MidiNetworkSession that were lost, with a human-readable cause; see MidiNetworkConnectionListener.packetsLost.
MidiNetworkReceived = ({MidiNetworkConnection connection, MidiPacket packet})
A packet received on a connection of a MidiNetworkSession.