MIDI implementation

@awgrover

1st Test results:

A Arduino Uno with MIDI-Shield was used for this test. MIDI out was connected to my PC. The incoming MIDI-Data was monitored with Cantabile Performer and MidiMon.

I used the note-node and two buttons for note on and note of:

midi.xodball (1.4 KB)

The monitor tool records the following data when I press a button (no matter which one):

Note Off, Channel: 1, Key: 10 (A#-1), Velocity: 0
Note Off, Channel: 1, Key: 60 (C4), Velocity: 0
Note Off, Channel: 1, Key: 50 (D3), Velocity: 48
Note Off, Channel: 1, Key: 55 (G3), Velocity: 51
Note Off, Channel: 1, Key: 53 (F3), Velocity: 48
Note Off, Channel: 1, Key: 32 (G#1), Velocity: 83
Note Off, Channel: 1, Key: 101 (F7), Velocity: 110
Note Off, Channel: 1, Key: 116 (G#8), Velocity: 32
Note Off, Channel: 1, Key: 109 (C#8), Velocity: 105
Note Off, Channel: 1, Key: 100 (E7), Velocity: 105
Note Off, Channel: 1, Key: 45 (A2), Velocity: 110
Note Off, Channel: 1, Key: 111 (D#8), Velocity: 116
Note Off, Channel: 1, Key: 101 (F7), Velocity: 32
Note Off, Channel: 1, Key: 54 (F#3), Velocity: 48
Note Off, Channel: 1, Key: 46 (A#2), Velocity: 48
Note Off, Channel: 1, Key: 48 (C3), Velocity: 86
Note Off, Channel: 1, Key: 101 (F7), Velocity: 108
Note Off, Channel: 1, Key: 32 (G#1), Velocity: 48
Note Off, Channel: 1, Key: 46 (A#2), Velocity: 48
Note Off, Channel: 1, Key: 48 (C3), Velocity: 32
Note Off, Channel: 1, Key: 111 (D#8), Velocity: 102
Note Off, Channel: 1, Key: 102 (F#7), Velocity: 13

Up to now, I’ve been blithely printing debug strings on the serial port (same as midi-port!).

  1. “Running Status” seems to be at play here: status bytes may be ommitted if the command is repeated.
  2. So, if I send NoteOn 60,127; then the character sequence “Sent”, it will be seen as 3 NoteOn events. And, that’s what your monitor output decodes to!
  3. So, I shouldn’t do that.
  4. I updated the library (1.2.2). No more debug printing (unless you include the debug node, and force it to be first).
1 Like

Hello awgrover!

With the new v1.2.2 update I got this messages on my MIDI monitor when I press the buttons for note on and note off:

Note Off, Channel: 1, Key: 10 (A#-1), Velocity: 0
Note Off, Channel: 1, Key: 60 (C4), Velocity: 0
Note Off, Channel: 1, Key: 52 (E3), Velocity: 49
Note Off, Channel: 1, Key: 57 (A3), Velocity: 48
Note Off, Channel: 1, Key: 53 (F3), Velocity: 52
Note Off, Channel: 1, Key: 49 (C#3), Velocity: 32
Note Off, Channel: 1, Key: 83 (B5), Velocity: 101
Note Off, Channel: 1, Key: 110 (D8), Velocity: 116
Note Off, Channel: 1, Key: 32 (G#1), Velocity: 109
Note Off, Channel: 1, Key: 105 (A7), Velocity: 100
Note Off, Channel: 1, Key: 105 (A7), Velocity: 45
Note Off, Channel: 1, Key: 110 (D8), Velocity: 111
Note Off, Channel: 1, Key: 116 (G#8), Velocity: 101
Note Off, Channel: 1, Key: 32 (G#1), Velocity: 54
Note Off, Channel: 1, Key: 48 (C3), Velocity: 46
Note Off, Channel: 1, Key: 48 (C3), Velocity: 48
Note Off, Channel: 1, Key: 86 (D6), Velocity: 101
Note Off, Channel: 1, Key: 108 (C8), Velocity: 32
Note Off, Channel: 1, Key: 48 (C3), Velocity: 46
Note Off, Channel: 1, Key: 48 (C3), Velocity: 48
Note Off, Channel: 1, Key: 32 (G#1), Velocity: 111
Note Off, Channel: 1, Key: 102 (F#7), Velocity: 102
Note Off, Channel: 1, Key: 13 (C#0), Velocity: 10

Note On, Channel: 1, Key: 60 (C4), Velocity: 127
Note On, Channel: 1, Key: 52 (E3), Velocity: 50
Note On, Channel: 1, Key: 54 (F#3), Velocity: 48
Note On, Channel: 1, Key: 54 (F#3), Velocity: 48
Note On, Channel: 1, Key: 51 (D#3), Velocity: 32
Note On, Channel: 1, Key: 83 (B5), Velocity: 101
Note On, Channel: 1, Key: 110 (D8), Velocity: 116
Note On, Channel: 1, Key: 32 (G#1), Velocity: 109
Note On, Channel: 1, Key: 105 (A7), Velocity: 100
Note On, Channel: 1, Key: 105 (A7), Velocity: 45
Note On, Channel: 1, Key: 110 (D8), Velocity: 111
Note On, Channel: 1, Key: 116 (G#8), Velocity: 101
Note On, Channel: 1, Key: 32 (G#1), Velocity: 54
Note On, Channel: 1, Key: 48 (C3), Velocity: 46
Note On, Channel: 1, Key: 48 (C3), Velocity: 48
Note On, Channel: 1, Key: 86 (D6), Velocity: 101
Note On, Channel: 1, Key: 108 (C8), Velocity: 32
Note On, Channel: 1, Key: 49 (C#3), Velocity: 50
Note On, Channel: 1, Key: 55 (G3), Velocity: 46
Note On, Channel: 1, Key: 48 (C3), Velocity: 48
Note On, Channel: 1, Key: 13 (C#0), Velocity: 10

I tried to connect the Arduino via USB to my PC. I used “Termite” to record the incoming data. The settings are 31250 81N. This is the result:

€<[00]37906 Sent midi-note 60.00Vel 0.00 off
<43928 Sent midi-note 60.00Vel 127.00
€<[00]45705 Sent midi-note 60.00Vel 0.00 off
<45926 Sent midi-note 60.00Vel 127.00

@awgrover:

I did some editing on your nodes (port names, description) to make them easier to understand for artists:

https://xod.io/libs/dox/x-midi/

Wish you a Merry Christmas and a Happy New Year! Thanks for all your work on this project and the help I got from you.

1 Like

@dox,
I’m not clear if things are working right for you,

Are you getting just the one on & off? The long list looks like by debug messages again, but the part after This is the result seems to show the right thing.

I incorporated your changes into awgrover/midi (the new “release” name).

Follow up with me if I missed something or to discuss more.

Hi everybody, I try since weeks to understand how to send or receive a midi note or parameters from/to usb device. it is not clear (for me) how to connect nodes between them . Is there’s someone can upload here a simple xod project like for example a button create a note and send it to the usb port? Thanks

Have you looked at the midi libraries people have shared? Libraries — XOD