# New MIDI Nodes: awgrover/midi

**URL:** <https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293>\
**Category:** Look What I’ve Done\
**Created:** [December 24, 2017, 7:39pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293 "2017-12-24T19:39:55Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![awgrover](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@awgrover](https://forum.xod.io/u/awgrover)\
**Post date:** [December 24, 2017, 7:39pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/1 "2017-12-24T19:39:55Z")

</div>

@dox and I created a few MIDI nodes. Use “Add Library” to get them: `awgrover/midi`

We’d love to see them used, get feedback, and fix any problems. They’ve only been tested lightly.

Right now, you are limited to the default MIDI serial port (`Serial` on most Arduino’s, `Serial1` on Leonardo, Due). I’m not sure how to expose multiple serial-ports. Also, I’m pretty sure “thru” doesn’t work.

- `note` starts and stops
- `control-change`
- `program-change`
- `bank-program-change`, aka “bank-select”
- `note-button` press starts, release stops

I have the code up on [https://github.com/awgrover/xod\_lib](https://github.com/awgrover/xod_lib). You can give feedback there, or here.

---

<div class="post-metadata">

**Author:** ![dox](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/dox/32/424_2.png) [@dox](https://forum.xod.io/u/dox)\
**Post date:** [January 1, 2018, 4:10pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/2 "2018-01-01T16:10:03Z")

</div>

Hello awgrover!

After updating to 0.17.1 and updating Arduino IDE to 1.8.5 I tried to test your new MIDI-nodes.

Forty Seven Effects Library is installed via Sketch Menu --\> Add Library

![arduino ide](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/12b72ca7ecd97bf01e3da4a5141570c05c41bdea.jpg)

Folder is copied to XOD library folder:

![kopie lib](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/c55ad79c27bb4b06c3688aeaa7d00fbd6ec95838.jpg)

New awgrover/midi nodes are installed.

But I got only error messages during uploading:

 ![fehler](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/61bce49d3d97d9a200e688f95ae01547317748e7.jpg)

Unfortunately I can not copy the whole text so I made a screenshot.

Any idea what’s going wrong?

---

<div class="post-metadata">

**Author:** ![nkrkv](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/nkrkv/32/8_2.png) [@nkrkv](https://forum.xod.io/u/nkrkv)\
**Post date:** [January 2, 2018, 12:15pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/3 "2018-01-02T12:15:49Z")

</div>

That’s because a dot terminating pin label `No.`. Pin labels are [not escaped anyhow](https://forum.xod.io/t/bug-patch-nodes-x-names-and-code-generation/239/7) currently. So, I suggest to rename `No.` → `No`

---

<div class="post-metadata">

**Author:** ![dox](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.xod.io/dox/32/424_2.png) [@dox](https://forum.xod.io/u/dox)\
**Post date:** [January 2, 2018, 4:01pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/4 "2018-01-02T16:01:57Z")

</div>

@nkrkv:

I tried to rename the node pin but this will not fix the problem:

 ![umbenamt](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/e05fa4f9e7f77a8406c976f44766d7b819339517.jpg)

Also after changing the note node:

 ![andere](https://canada1.discourse-cdn.com/flex027/uploads/xod/original/1X/37186635f5c7cb600950c932ca25378f46dd25e0.jpg)

---

<div class="post-metadata">

**Author:** ![microsoundfield](https://avatars.discourse-cdn.com/v4/letter/m/9de0a6/32.png) [@microsoundfield](https://forum.xod.io/u/microsoundfield)\
**Post date:** [January 16, 2018, 10:07pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/5 "2018-01-16T22:07:57Z")

</div>

thx for this one … !!!

control-change has in the line 37-39 (inside the node) old, not declared variables (just naming syntax) , the compiler goes wild at this point ::

37: auto channel = getValue\<input\_channel\>(ctx); / **// should be:: input\_Ch**  
38: auto controller\_number = getValue\<input\_controller\_number\>(ctx); **// should be :: input\_CC**  
39: auto control\_value = getValue\<input\_control\_value\>(ctx); **//// should be :: input\_Val**

and the debug section is recomend to comment out , it gives lot of data in the midi channel…

i edited the nodes code for myself , but you could update this one globally.

THX !!

---

<div class="post-metadata">

**Author:** ![awgrover](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@awgrover](https://forum.xod.io/u/awgrover)\
**Post date:** [January 20, 2018, 3:24pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/6 "2018-01-20T15:24:01Z")

</div>

I finally repaired this. It was pure sloppiness on my part. It compiles now. I would appreciate feedback on whether it actually works.

[awgrover/midi v1.3.2](https://xod.io/libs/awgrover/midi/)

I added a link to the installation steps, which are a bit of a pain.

---

<div class="post-metadata">

**Author:** ![awgrover](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@awgrover](https://forum.xod.io/u/awgrover)\
**Post date:** [January 20, 2018, 3:38pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/7 "2018-01-20T15:38:13Z")

</div>

> [@microsoundfield](#):
>
> and the debug section is recomend to comment out , it gives lot of data in the midi channel…

Again, I was sloppy. Fixed. v1.3.3. @microsoundfield, thanks for catching that.

---

<div class="post-metadata">

**Author:** ![the19thbear](https://avatars.discourse-cdn.com/v4/letter/t/df788c/32.png) [@the19thbear](https://forum.xod.io/u/the19thbear)\
**Post date:** [December 26, 2018, 7:18pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/8 "2018-12-26T19:18:17Z")

</div>

How do you actually hook the arduino up with a daw? I i make a midicontroller usign your nodes, hwo do i get the DAW to reckognise the arduino as a midi device etc?  
Thanks:)

---

<div class="post-metadata">

**Author:** ![copsmusic](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@copsmusic](https://forum.xod.io/u/copsmusic)\
**Post date:** [January 6, 2019, 3:10pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/9 "2019-01-06T15:10:05Z")

</div>

Hello awgrover,

Happy new year to you and thanks for your work.  
In your XOD midi library, I can’t see any way to read input midi data so I tried to create a XOD midi read node (based on the Midi.h library) but I didn’t succeed yet. It seems that Callbacks are not handled correctly by XOD. May be you had the same issue one year ago.  
But may be one year later, you have new ideas to manage a midi read node for XOD. It would be really cool !! Please let me know if you have a trick to do that !!

Thanks !

---

<div class="post-metadata">

**Author:** ![awgrover](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@awgrover](https://forum.xod.io/u/awgrover)\
**Post date:** [January 6, 2019, 4:58pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/10 "2019-01-06T16:58:10Z")

</div>

It’s been a while since I worked on the midi-library. I don’t remember why I didn’t do a `read` node.

I haven’t tried to deal with callbacks in XOD yet. @bradzilla84 is thinking about them for the [Picaso-Serial-Arduino-Library](https://github.com/4dsystems/Picaso-Serial-Arduino-Library). Contact him and see what he has thought of.

I think it might be safe to have the callback cause a pulse to be emitted: as if the `read` node did it. Possibly including the callback function with the `read` function’s `.cpp` would give you lexical access to the correct `ctx`. Setting a flag and then polling for it on “every clock pulse” is another possibility. I’d be curious about @bradzilla84’s thoughts.

If you want to add to the library, I’m very glad to have you do so. Looks like the library is currently in [https://github.com/awgrover/xod\_lib](https://github.com/awgrover/xod_lib), I’d be happy to break it out into a separate repository so you could fork/collaborate/etc.

---

<div class="post-metadata">

**Author:** ![copsmusic](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@copsmusic](https://forum.xod.io/u/copsmusic)\
**Post date:** [February 7, 2019, 12:08pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/11 "2019-02-07T12:08:43Z")

</div>

Hello awgrover,

I realize that I didn’t thank you for your answer. Sorry for that. Must be the XOD fever 😉

I worked on the MIDI library and I just posted this :

> [@A basic MIDI library](https://forum.xod.io/t/a-basic-midi-library/1821):
>
> Hey guys, I’ve created a basic MIDI library in order to handle MIDI processing : [https://xod.io/libs/copsmusic/midi-basic](https://xod.io/libs/copsmusic/midi-basic) You have nodes to initialize MIDI IN and MIDI OUT communication. You can read the input messages from the MIDI IN. You can also handle and send : Note ON Note OFF Contron Change (CC) Program Change Aftertouch Channel, PitchBend Feel free to comment and give me feedback to improve it. Thanks

I will be happy to have your feedback on this and how to improve it.

I’m also working on a more complex MIDI library in order to handle multiple MIDI IN and OUT ports and stuff like merging, splitting, morphing MIDI data.

Regards.

---

<div class="post-metadata">

**Author:** ![awgrover](https://avatars.discourse-cdn.com/v4/letter/a/74df32/32.png) [@awgrover](https://forum.xod.io/u/awgrover)\
**Post date:** [February 16, 2019, 2:40pm UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/12 "2019-02-16T14:40:42Z")

</div>

Please take whatever is useful from my library. I made the library for someone else, so the library is not based on my own use/experience. If you think you’ve covered the functionality, I can mark my library deprecated and refer them to yours.

---

<div class="post-metadata">

**Author:** ![copsmusic](https://avatars.discourse-cdn.com/v4/letter/c/51bf81/32.png) [@copsmusic](https://forum.xod.io/u/copsmusic)\
**Post date:** [February 20, 2019, 11:28am UTC](https://forum.xod.io/t/new-midi-nodes-awgrover-midi/293/13 "2019-02-20T11:28:34Z")

</div>

Hello,

Thanks for your reply and for your state of mind. It’s great to see people like you !  
I think my library covers the basic functionalities. I use it almost every day. I think it’s pretty much stable but may be it needs to be tested a little more (with other boards for exemple).
