sorry for this cluttered mess. i tried to enhance the descriptions
my debian laptop has a bookworm and jack, pipewire, some daws, REAPER, ardour, QTRACTOR and some synths, i use QSYNTH down there and the QTRACTOR and i have plugged in a AKAI MIDIMix (MIDI device), the MIDIMix in default state sends notes, so it is somehow a kind of weird MIDI-keyboard
using the MIDIMix in a more usual way is via my REAPER template with the MIDIMix as dub-mixer (shameless advertising)

first : pipewire pure
i open the pipewire graph thing (i find this in the menu for Media...) with nothing started and i see this
you will find the MIDIMIDIMix if you search for it and you see all the stuff the pipewire has recognized

if i open the graph in the jack (qjackctl -graph)
i see a similar picture

i start a2jmidid via commandline and let it run all the time.and yes, there are ways to get it running on systemstart,or with the jack ,..

pw graph
the a2jmidid is now there amongst the other stuff
btw. the equal colored stuff knows each other, draw lines from and to equal colored thingies to manage routingsyou will find graphs with routings below

jack graph look like this then
as jack is similar to pw from now on only pw graphs

i start REAPER with audio settings with pulseaudio

REAPER MIDI settings with pulseaudio

i switch REAPER to jack
we need jack aka pipewire to get more channels in the end
Input and Output channels can be more than those 2

REAPER jack MIDI has more channels by default (i think)
it's full of channels

pw graph
REAPER with few MIDI chans
they are there but aren't set in REAPER

REAPER settings
enabling some MIDI channels

pw graph
REAPER with the enabled MIDI channels
it's full of channels again

pw graph
i unplugged the MIDIMix for fun to see how the picture is changing

take a look at the red MIDI bridge thingy. it is missing the MIDIMix

pw graph
i plugged the MIDIMix in and started QSYNTH
starting this stuff will usually make some routings by itself
hence the lines

here some QTRACTOR settings
looks random for me
you can draw those lines in the pw graph where you have a good sight on all this stuff

pw graph

REAPER with 1 track MIDI input (instrument channel)
REAPER listen to the MIDI input this way

pw graph
REAPER 8 in and 8 out, i set the audio input and output (i mentioned it above) to 8 channels

REAPER settings
route MIDI hardware output in a track. i took channel 7 here
click the route icon on a track to see this

pw graph
youi see in the graph thosae connections for MIDI from and to REAPER and qsytnth an MIDIMix
REAPER feeds the QTRACTOR here

pw graph
and another one

REAPER timesyncsettings
you can control REAPER with other devices via the timesync functions
you can control REAPER with other devices via the timesync functions
i start stop REAPER via another daw this way. With QTRACTOR it is faulty, but i got good results with TRACKTION WAVEFROM