Translate MIDI note events into UDP relay commands.
- Reads raw MIDI bytes from a serial port.
- Maps MIDI note/channel to relay outputs using a map file.
- Sends
set <hex>commands over UDP to a relay controller. - Periodically reloads the map file and sends
pingkeepalives.
Linux/Unix:
cd src
makeWindows:
- Open
win32/midi.slnin Visual Studio and build themidiproject.
./midi2relay -vCommon options:
-vincrease verbosity (repeatable).-d <pidfile>run as a daemon (Unix).-f <config_file>reserved (not currently used).-t <ip:port>target relay host/port (see notes below).-s <device>serial device path (default/dev/ttyAMA0).-u <port>UDP listen port (default0, disabled).
Default path in code:
/var/www/html/uploads/map.txt
Format (one mapping per line):
<note> <channel> <relay>
Valid ranges:
note: 0-127channel: 0-15relay: 0-127
Lines starting with # are comments.
- Serial port:
/dev/ttyAMA0at 38400 8N1 raw. - Target UDP host:
127.0.0.1 - Target UDP port:
1027
- None currently tracked. See
TODO.mdfor open work.
- Architecture:
docs/architecture.md - Diagrams:
docs/midi.pdf,docs/midi-flow.jpg,docs/midi-processing.jpg
src/core application and utilitiestest/manual serial read testwin32/Visual Studio solutiondocs/supporting documents
Linux/Unix (from source):
- Build:
cd src && make - Move the binary into your PATH, for example:
sudo cp midi2relay /usr/local/bin/
Windows:
- Open
win32/midi.slnin Visual Studio. - Build the
midiproject to produce the executable.
- Serial port open fails:
- Confirm the device exists:
/dev/ttyAMA0(or update in code). - Check permissions and that no other process is using the device.
- Confirm the device exists:
- No relay updates:
- Verify the map file path and contents.
- Increase verbosity with
-vand look for load/parse output. - Ensure the relay target UDP host/port matches your controller.
- Map file changes not taking effect:
- The file is only reloaded when mtime changes and checked ~every 60s.
- UDP send appears silent:
- There is no inbound UDP handling; only outbound
setandpingare used.
- There is no inbound UDP handling; only outbound