Created
January 26, 2021 18:02
-
-
Save chmanie/4f2838f4548d25b9c883f7d6d074f67c to your computer and use it in GitHub Desktop.
Connect all MIDI inputs to all MIDI outputs (except themselves). Supports multi-port devices
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/ruby | |
t = `aconnect -i -l` | |
$devices = {} | |
$device = 0 | |
t.lines.each do |l| | |
match = /client (\d*)\:((?:(?!client).)*)?/.match(l) | |
# we skip empty lines and the "Through" port | |
unless match.nil? || match[1] == '0' || /Through/=~l | |
$device = match[1] | |
$devices[$device] = [] | |
end | |
match = /^\s+(\d+)\s/.match(l) | |
if !match.nil? && !$devices[$device].nil? | |
$devices[$device] << match[1] | |
end | |
end | |
$devices.each do |device1, ports1| | |
ports1.each do |port1| | |
$devices.each do |device2, ports2| | |
ports2.each do |port2| | |
# probably not a good idea to connect a port to itself | |
unless device1 == device2 && port1 == port2 | |
system "aconnect #{device1}:#{port1} #{device2}:#{port2}" | |
end | |
end | |
end | |
end | |
end |
ElJimBob
commented
Oct 20, 2021
I think the problem might be that the input ports on the device do not match the number of output ports but I might be mistaken. I'd have to debug that again and try to replicate the issue. Sorry if this is taking a long time
Has anyone had a Roland TB-03 working with their hub? When I run aconnect -l it can see the device and it's connected but I can't seem to access it from any of my other devices.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment