Hi all, issue with MIDI on Pi4b. I’ve got the audio working ok, done the installs as recommended. But the MIDI wont work for me. I’m using (or trying to use) the 5 pin DIN MIDI sockets.
I get the MIDI output port names using mido.get_output_names(), which gives me this list:
Midi Through:Midi Through Port-0 14:0
pisound:pisound MIDI PS-3YAQJAK 28:0
pisound-ctl:pisound-ctl 128:0
then i try this to send midi clock:
import mido
import time
output = mido.open_output(‘pisound-ctl’) # this is the only one that doesnt give an error
clock_message = mido.Message(‘clock’)
print(“\nSending MIDI Start…”)
output.send(mido.Message(‘start’))
while True:
output.send(clock_message)
print(“\nSending MIDI Clock…”)
time.sleep(1/24)
My midi interface doesnt register anything happening and i have a midi monitor software looking at it and that is also quiet. The Pisound pcb doesnt seem to have any indicator of MIDI happening either. The only thing i can think of so far is that ‘pisound-ctl’ is incorrect somehow. Can anyone point me in the right direction?
Hi, pisound-ctl does not participate in this area. Clock messages are sometimes ‘hidden by default’ in some MIDI monitors, as they are rather noisy, and can better be expressed as a BPM estimate. Because of that, Pisound does not indicate Clock messages either, otherwise the LED would be constantly on or at least blinking frequently. Instead it blinks the activity LEDs on significant events such as Note On, Note Off, Control Change, Program Change, etc…
Use these commands to test midi, make sure the ports are not reserved by other software:
amidi -p hw:pisound -S "90 3C 64"
to send a Note On Middle C (60) event on Ch. 1 with 100 velocity.
Use this command to monitor for incoming events:
amidi -p hw:pisound -d -a -c
Alternatively, you can use aseqsend and aseqdump utilities.
ok thanks. I worked some more on and got it working using rtmidi instead of mido. rtmidi found the interface immediately and was much easier to use. I also got a free MIDI monitor software that works quite well - MidiView.
heres the code i used:
import time
import rtmidi
out = rtmidi.MidiOut()
out.open_port(1)
with out:
while True:
out.send_message({0xF8})
#print(“\nSending MIDI Clock…”)
time.sleep(1/24)