On Tue, Nov 08, 2022 at 11:31:24AM +0100, Brian Durant wrote:
> I am trying to connect my MIDI keyboard to the Sf2 Player, in LMMS. sndio
> MIDI is set under MIDI interface in the MIDI settings section of the LMMS
> preferences. DMESG gives me the following when I plug my MIDI keyboard into
> the computer:
> 
> umidi0 at uhub0 port 5 configuration 1 interface 0 "KORG INC. microKEY2" rev
> 1.10/1.02 addr 3
> umidi0: (genuine USB-MIDI)
> umidi0: out=1, in=1
> midi0 at umidi0: <USB MIDI I/F>
> 
> I have read the three bits of LMMS documentation on MIDI, and I am familiar
> with how to use fluidsynth to connect directly with my MIDI keyboard to the
> default soundfont:
> 
> $ fluidsynth /usr/local/share/generaluser-gs/GeneralUser_GS.sf2
> $ midicat -d -q midi/0 -q midithru/0
> 
> Unfortunately, none of this seems to work in LMMS. Clicking on the action
> gear for the Sf2 Player plugin shows MIDI input and output, but does not
> list my MIDI keyboard (as in Linux or Windows) so that I can bind it to the
> Sf2 Player. There is very little information about using MIDI instruments in
> the OpenBSD FAQ, and my knowledge of sdiod and jack are limited.

Basically, sndio MIDI attempts to look as MIDI hardware.

The computer's MIDI ports are named "midi/0", "midi/1", .. and (in the
default sndiod config) they correspond the "midi0 at ..." lines of
dmesg.

There are also software MIDI thru boxes refered as "midithru/0",
"midithru/1", ... For instance, when a program sends events to
"midithru/0" all other programs connected to "midithru/0" receive the
events.

By default programs use "midithru/0" as MIDI port.

Certain have no MIDI port selector, but the default port may be
changed with the MIDIDEVICE environment variable.

> The only way that I have found that I can get this to work, is if I run $
> midicat -d -q midi/0 -q midithru/0 from the command line, before I open LMMS
> and I then select MIDI input in the Sf2 Player action gear. However, this
> allows only for one MIDI instrument at a time. If I also want to connect a
> drumpad like the Akai MPK 218, would I run $ midicat -d -q midi/1 -q
> midithru/1 and how do I set MIDI input in the Kicker plugin to only get the
> MIDI signals from the drumpad and not the keyboard? Perhaps LMMS and sndio
> are only setup for something like the Akai MPK Mini MKIII?
> 
> Any help trying to wrap my head around how MIDI, sndio and jack work in this
> context is appreciated.
> 

If you've multiple MIDI controllers, you could assign a MIDI channel
to each (most MIDI controllers have a knob to do so) and then route
them all to "midithru/0" so lmms or fluidsynth see them as a single
port. For instance:

midicat -d -q midi/0 -q midithru/0
midicat -d -q midi/1 -q midithru/0

Then, in lmms (or fluidsynth), configure each track's "Input channel"
setting to the corresponding input (click on the "keyboard" icon, then
the "enable midi input" button, then select the channel number).  If
you need a more complex MIDI routing, you could try the audio/midish
port.

Note that certain programs count channel numbers from 0 other from 1.

You may need to set sndiod latency (ex. "-z 128" option) and lmms
buffer size (Edit->Settings set buffer size to 128).

Reply via email to