MIDI over LAN, kind of…

001I didn’t quite get there, but at least I was able to send MIDI commands to a connected synthesizer via a Web page in Netduino. The reason I didn’t get further now was that the MFToolkit Web server ran out of memory, despite my application being very small, and I spent some time trying to find out why. Not that MIDI over LAN needs a complete Web server anyway, except for remote configuration, but I wanted to test out MIDI (at all) first.

Despite Netduino outputting 3.3 Volts instead of the 5 Volts the MIDI shield is designed for, there was no problem sending and receiving MIDI. To be on the safe side I could change the resistor values, but as they are surface-mounted I will probably let it be.

To handle any kind of numeric input (for e.g. the MIDI command values) I developed a parser class for integer values that supports forced number base selection via a setting in the call as well as via prefixes in the value string, namely “0x” (hexadecimal), “0b” (binary), “0” (octal”). It also supports “-“ (negation) and “~” (inversion) for all number bases. It handles number bases from 2 to 41 (0-9, A-Z), even though only 2, 10 and 16 are really relevant (the other ones came without extra effort).

As usual, the amount of reusable classes grows. So far: Midi, LedStatus, LedRgb, Color, Parse and Wave. I’ve found that immediately making something generic into a class saves time in the short term (testability, robustness, abstraction, clear interface, independence, etc) and even more in the long term.