[LAU] how can I send a midi command from bash through jack to my HW controller?

Christopher Arndt chris at chrisarndt.de
Sun Oct 8 11:39:01 UTC 2017


Am 08.10.2017 um 01:50 schrieb Jeanette C.:
> If Python or other scripting languages are an option, there are some
> packages for these languages which support ALSASEQ I/O. If midish looks
> promising, but too much work for a start, I could help.

For example, here's how you would use my python-rtmidi package [1] to
send a control change message for controlelr #1 (modulation) with value
127 to the first JACK MIDI port that contains the string "BCR 2000" in
its name:

import rtmidi
from rtmidi.midiutil import open_midioutput
from rtmidi.midiconstants import CONTROL_CHANGE, MODULATION_WHEEL

midiout, portname = open_midioutput(
	port='BCR 2000',
        api=rtmidi.API_UNIX_JACK,
        client_name="My test client")
midiout.send_message([CONTROL_CHANGE, MODULATION_WHEEL, 127])


If you want to use ALSA, just drop the 'api' keyword parameter to the
'open_midioutput' function.

[1] https://pypi.python.org/pypi/python-rtmidi


Chris


More information about the Linux-audio-user mailing list