my udp.py
#in the config disabled dhcp and set fixed ip
cranked the gain from 0.2 to 0.8, disabled reverb and chorus
(you need to edit the .cfg files for individual soundfonts because those will overide the main config
didn't get rtp working but udp works pretty ok.
midi over wifi can sometimes be a bit wonky but the latency isnt bad.
was hoping to make use of my other midi keyboard in my closet but the notes would get stuck
#!/usr/bin/env python3
from signal import SIGINT, signal
from socket import AF_INET, SOCK_DGRAM, socket
from threading import Event
from rtmidi import MidiIn
UDP_HOST = "192.168.0.100"
UDP_PORT = 1999
MIDI_PORT_NAME = "mt32-pi UDP socket"
sock = socket(AF_INET, SOCK_DGRAM)
midiin = MidiIn()
midiin.open_virtual_port(MIDI_PORT_NAME)
signal(SIGINT, lambda *_: exit(1))
print(
f"Listening for MIDI on port '{MIDI_PORT_NAME}' and sending to"
f" {UDP_HOST}:{UDP_PORT} (Ctrl-C to exit)..."
)
midiin.ignore_types(False, False, False)
midiin.set_callback(lambda msg, _: sock.sendto(bytes(msg[0]), (UDP_HOST, UDP_PORT)))
Event().wait()