Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 15 of 15

Thread: MIDI Library on UDP

  1. #1
    Junior Member
    Join Date
    Apr 2017
    Posts
    5

    MIDI Library on UDP

    Hi all,
    I would like to know if there is a relatively simple way to make an UDP interface that can replace the current "Serial" transport layer in the MIDI_Libray in order to use the beauty of the library itself on the midi message's manipulation (callbacks, etc.) on a faster and more flexible configuration.

    Here I'm not referring to the Apple-Midi standard.
    I would like to use the midi-library in a setup that require "udp multicast" and involve the ipMIDI software ( http://www.nerds.de/en/ipmidi.html ).

    I know that a previous problem that did not allowed use of udp multicast has been resolved on teensyduino 3.6 release.
    (https://forum.pjrc.com/threads/42468...=udp+multicast).

    Please, can someone point me in the right directions?

    Thank you!

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    20,677
    I just looked at their website. I didn't see any sort of specification for those ipmidi protocol, like which UDP port number, whether the MIDI messages are packed a 2-3 bytes like serial or 4 bytes like USB or some other way, and how they're doing the 20 cables part.

    But I did see their software is a free trial with 60 minute time limit, until you pay. What are the odds they're willing to open the protocol to allow other free implementations?

  3. #3
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    Hello Paul and thanks for the quick response.

    I'm not an expert but from what I understand so far:

    - the ipMidi OSX version is free

    - from here (http://www.midi-and-more.de/midi2ether.htm) I see that the IP need to be set to 225.0.0.37 and the port to 21928

    - there are some hardware manufacturers who implement the protocol
    (Http://www.nerds.de/en/ipmidi_hardware.html)

    - The QmidiNet application is free and open-source and seems to be compatible with ipMIDI too
    (Https://github.com/rncbc/qmidinet)

    I hope that some of these informations can help you better understand a possible implementation

    Thank you again!

  4. #4
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    I would like to use another way for the midi trasmission over udp mainly because I think that the "complexity" of the RTP-MIDI system, related to the mechanism of session creation, invitations, checkings, ecc., them all can add some latency that could be avoided in Real Time Applications.
    I think that a more simpler system (and yes, more error prone) could be better in the above situations.

  5. #5
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    Here another (old) repository that maybe could help to understand the message management in the ipMIDI way..

    https://github.com/teknopaul/midiOverIP

  6. #6
    Junior Member
    Join Date
    May 2018
    Posts
    4
    Hi

    Have you ever found out how the MIDI messages must be formatted for ipMIDI ?

  7. #7
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,199
    Quote Originally Posted by peeddrroo View Post
    Have you ever found out how the MIDI messages must be formatted for ipMIDI ?
    I believe it's the same as BLE MIDI. The specs are off line ATM.

    https://www.midi.org/specifications-...tions-and-info

  8. #8
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    375
    The actual protocol literally is nothing special at all, what I mean by this is it's just the MIDI protocol over UDP. How do I know this? I used Wireshark to view messages that ipMIDI sends.
    Each UDP message can have a maximum of 128 bytes of data, now what is in those 128 bytes is up to you. There can be any number of MIDI messages packed in there.
    Now if your messages are larger than 128 bytes, for example SysEx, then you simply send it in 128 byte chunks.

    You don't have to add anything to your original MIDI messages you just send them straight over UDP.

  9. #9
    Senior Member oddson's Avatar
    Join Date
    Feb 2013
    Location
    Isle in the Salish Sea
    Posts
    1,199
    They have to be packed and tagged with a timecode.... don't they?

  10. #10
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    375
    Nope, nothing besides standard UDP.

  11. #11
    Senior Member
    Join Date
    Mar 2013
    Posts
    126
    UDP packets can and often are dropped on the floor. This can't be detected unless there is some kind of sequencing field in each packet.
    Unless you tightly control the physical network the packets go over (and there are no bugs in the switches) you will experience drops which can be tricky with MIDI producing stuck notes etc.

  12. #12
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    375
    Indeed this would be an issue with ipMIDI as it has no way to detect this and that’s why the commercial products that use ipMIDI aren’t WiFi products. I believe that Apple-MIDI/rtpMIDI has a way to fix that, but as mentioned in the original post he didn’t want to use it.

  13. #13
    Junior Member
    Join Date
    Apr 2017
    Posts
    5
    Hello everyone!
    Yes, my idea is to implement the system using physical connections and not wifi.
    Moreover, the problems concerning the loss of information (stuck notes etc.) are easily manageable live in my situation. Recently, thanks to the contribution of a user/developer, some changes to the midi library have been proposed (and implemented!).
    I hope this can help other developers to make the library more flexible and usable in different contextes...

    You can find more information here:
    https://github.com/FortySevenEffects...ary/issues/123
    and here:
    https://github.com/lathoub/Arduino-ipMIDI

  14. #14
    Senior Member vjmuzik's Avatar
    Join Date
    Apr 2017
    Location
    Florida
    Posts
    375
    There really is no protocol to it besides standard MIDI message, if you open a UDP multicast socket to the correct port number you just send your MIDI message straight to it with no changes or additions to the original message.
    For example, this would send the MIDI message to turn off middle C:
    Code:
    IPAddress multicast(225, 0, 0, 37);
    uint8_t messsage[3] = {0x80,0x3C,0x00};
    UDP.beginPacket(multicast,21928);
    UDP.write(message,3);
    UDP.endPacket();

  15. #15
    Junior Member
    Join Date
    May 2018
    Posts
    4
    Thanks everyone for the replies.
    I came to the same conclusions: ipMidi sends raw MIDI messages over UDP with no extra stuff.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •