r/MidiNet 10d ago

Midinet v0.1 for Digital Audio

Midinet protocol for delivering Digital Audio with Midi timestamps in common Ethernet.

What ?

Midinet delivers digital audio with Midi timestamps in Ethernet with very low latencies directly between synthesizers without routers and hubs. Midinet digital audio packets include Midi JR timestamps for exact syncing between Midi note events and digital audio. The user can select both daisy chain and star topology with Ethernet cables.

In daisy-chain, you can connect tens of synthesizers with under 5 millisecond round-trip latency for Midi packets and digital audio. Midinet protocol is designed mainly for home synth setups. You can also listen to all synths from one synths output jack, without any analog mixers or cables. You can also calculate songs faster than real time (burst-mode with Midi timestamps). Synthesizers send complete tracks, like bass-lines, back to the computer in a few seconds. Synthesizers can create their own audio stream or mix their audio to existing stream.

Protocol latency test below with ethernet cables and packet forwarding.

Why ?

Altough there are similar protocols like Dante, Aes67, A2B, IEEE etc. those often require specialized hardware and lack features like faster-than-realtime audio, on-the-go mixing and Midi timestamps. Many also require an expensive license, while Midinet is free and open. Midinet protocol is designed mainly as a light-weight digital audio alternative for home synthesizers.

json at synthesizers

    midinet-stream-id                     0               ; stream id
    midinet-stream-enable                 10              ; enabled seconds
    midinet-stream-type                   create          ; create or mix to stream (daisy-chain)
    midinet-stream-time                   realtime        ; realtime (udp) or burst (tcp)

    midinet-stream-server-ip              192.168.1.51
    midinet-stream-server-protocol        udp 
    midinet-stream-server-port            7002

    midinet-stream-format-hz              48000
    midinet-stream-format-bps             32
    midinet-stream-format-floating-point  0
    midinet-stream-format-channels        2
    midinet-stream-format-samples         24
    midinet-stream-format-byte-order      0
    midinet-stream-format-divider         1
    midinet-stream-format-header-type     0
    midinet-stream-format-db0             24

    midinet-stream-include-midich         all
    midinet-stream-include-note           all
    midinet-stream-include-instrument     all
    midinet-stream-include-velocity       all
    midinet-stream-include-pitchbend      all

    midinet-stream-control-volume         65535
    midinet-stream-control-pan            32768
    midinet-stream-control-effect-type    0
    midinet-stream-control-effect-value   0

    midinet-stream-status                 ok              ; ok,error,busy

Ethernet packet format for audio

StreamID, Flags, Midi JR timestamp of the first sample (extrapolated), Packetcount, AudioData.

flags: JR valid(0), packetcount valid(1), JR reset(2), packetcount reset(3), JR rounded(4)

  Byte 0           Byte 1           Byte 2          Byte 3
┌────────────────┬────────────────┬────────────────────────────────┐
│ StreamID (8b)  │  Flags (8b)    │       Midi JR (16b)            │  <- First 32 bits
├────────────────┴────────────────┴────────────────────────────────┤
│                        PacketCount (32b)                         │  <- Second 32 bits
├──────────────────────────────────────────────────────────────────┤
│                                                                  │
│                        AudioData (PCM)                           │  <- Audiodata starts here
│                                                                  │

Audio server

  1. Modifies json parameters at synthesizers (Midi 2.0 PE, Http put/patch, ..)
  2. Receives the sent digital audio packets.

Server runs on computers or synthesizers, so you could listen to all synths from single synths output port.

Protocol and latency test

Protocol and latency test used two 3Ghz x86-64 computers with i8256x network cards.

  1. Computer A sent audio waveform packet with rdtsc-timestamp to Computer B
  2. Computer B summed its own waveform to the audio packet and sent it back to Computer A
  3. Computer A displayed the difference in rdtsc timestamp / 2 to get the per hop latency.

At 100mbps, latencies for Ethernet UDP packet with store/forward are following:

- Midi note packet (16 bytes) - below 40 microseconds

- Audio packet (8 byte header + 24 samples * 2 channels * 32bits) - below 60 microseconds

100Mbps - 50 synths in daisy-chain has a round-trip latency under 5 milliseconds.

1000Mbps - 70 synths in daisy-chain has a round-trip latency under 5 milliseconds.

Comparison to other audio protocols

=====================================================================================================
Feature          Midinet         IEEE avb/tsn     Aes67/Ravenna     A2B             Dante
=====================================================================================================
Licensing        Free/Open       Free/Open        Free/Open         Prop.chips      Proprietary

Hardware         Standard        Req.AVB/TSN      Standard          A2B transc.     Dante HW or
                 Ethernet        switches         Ethernet          No ethernet     Ethernet+Hub

Control          Midi 2.0 PE,    IEEE-802/1722    mDNS,RTSP,NMOS    Proprietary     Dante 
                 Http (json)                                        software        Controller

Streamtypes      Individual      Individual       Individual        Individual      Individual
                 Mixed

Streamtime       Realtime        Realtime         Realtime          Realtime        Realtime
                 Burst

Timing           Midi JR         PTPv2            PTPv2             Time-Division   PTPv1/PTPv2
                                                                    Multiplex
=====================================================================================================

Links

https://midi.org/network-midi-2-0-udp-overview

1 Upvotes

1 comment sorted by

2

u/Specialist-Dog-501 2d ago

I don't understand all of it, but impressed! Hope you find some devs supporting this, awesome!