basic questions about jack and midi

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

HarryR
Established Member
Posts: 30
Joined: Thu Dec 22, 2016 2:10 pm
Been thanked: 2 times

basic questions about jack and midi

Post by HarryR »

Hi,

it seems my knowledge is not yet enough to understand
things belonging midi and jack :(

So, here are some questions to (hopefully) make me a little wiser :)

I made screenshots of qjackctl where I refer to in the following text.

My usb-midi-keyboard is the only midi-aware "thing/device" which is plugged in.

JACK1.png These shots show my actual configuration (sorry it's in german language !)
I think it's well configured. If not, please tell me what's wrong or what could be optimized.

I start jack with this configuration, and now show which connections are made by default:

JACK2.png:
Audio: seems to be okay, PA jack sink makes audio possible for non-jack-applications.

JACK-MIDI: : why are there two midi_captures ? midi_capture_1 is there by default (with no keyboard plugged in).
Where does it come from ?
midi_capture_2 is the usb-midi-keyboard, when I unplug and replug it's named midi_capture_3, midi_capture_4 and so on …
Can I fix this so only midi_capture_2 will be used when I plug in my usb-midi-keyboard ?

What/where the hell is midi_playback_* ?
It's there by default, so it seems to be provided by Linux itself.

ALSA-MIDI:

This shows the nearest to hardware (devices) ?!
There's my usb-midi-keyboard (MK-461C).
Left is the (readable) "device" which gives me midi events.
Right is the (writable) "device" which is kind of input for midi events on usb-midi-keyboard (MK-461C).
What the hell does this mean ?
If I think of a keyboard, this would mean my keyboard produces "char"-events and can read "char"-events,
which would be nonsense as it doesn't read.
So, can someone tell me what this means in terms of midi ?

Midi_Through: It's always there and so not belonging to usb-midi-keyboard, and so kind of system device
provided by Linux.

My idea: it is used if multiple midi-apps shall read midi events, because if not "used" only one app can
read and then "eat" midi event.

So, how do I configure "through" so multiple devices can read midi events (if it seems to be useful) ?

I know, theses are beginner questions, but in fact I am a beginner belonging to midi
and I need to get those questions answered to be able to do further "midi-things" in the future.

Or - better said - I need to know the basics.

It would be kind if someone helps me to get the basic knowledge.

Best regards
Harry
Attachments
JACK2.png
JACK2.png (123.67 KiB) Viewed 2067 times
JACK1.png
JACK1.png (203.69 KiB) Viewed 2067 times
User avatar
sunrat
Established Member
Posts: 1064
Joined: Wed Jul 22, 2020 2:08 pm
Has thanked: 175 times
Been thanked: 287 times

Re: basic questions about jack and midi

Post by sunrat »

What distro are you using?
You need a2jmidid for JACK MIDI to see ALSA MIDI devices.
Dedicated media distros such as AVL-MXE have this set up by default.
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 360 times

Re: basic questions about jack and midi

Post by j_e_f_f_g »

This jackmidi thing is a curse. Now setting up MIDI on Linux, which used to be fairly easy/straightforward), is getting as troublesome as setting up digital audio. Thank you guy-who-made-jackmidi for wrecking Linux some more. May bad luck follow you wherever you go.

My sincere advice to the OP is:

Whenever you come across a program that requires jack-midi, toss that program away. Don't use it. It was written by a programmer who lacks even the minimal competence to write software that uses the linux operating system's midi api. (And that's inexcusable since the alsa midi api is very simple.) Don't indulge bad programmers.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

HarryR
Established Member
Posts: 30
Joined: Thu Dec 22, 2016 2:10 pm
Been thanked: 2 times

Re: basic questions about jack and midi

Post by HarryR »

sunrat wrote: Mon Jul 25, 2022 3:10 pm What distro are you using?
You need a2jmidid for JACK MIDI to see ALSA MIDI devices.
Dedicated media distros such as AVL-MXE have this set up by default.
I'm using ubuntu 20.04 LTS.
I'll have a look for AVL-MXE.

I see midi devices, so I don't know if it is necessary to invoke a2jmidid.

My (real) goal is (as I wrote in another thread) to find a way that the controllers on the midi-keyboard
trigger, let's say a bank change or an effect like chorus ... My all over goal is, that kind of midi live setup is configured.
This means everything (whatever it is) is configured BEFORE starting to play live and while playing, changes are made
simply on /with keyboard. I want to have the concentration on the music

(Many words for a simple wish :lol: )
HarryR
Established Member
Posts: 30
Joined: Thu Dec 22, 2016 2:10 pm
Been thanked: 2 times

Re: basic questions about jack and midi

Post by HarryR »

j_e_f_f_g wrote: Mon Jul 25, 2022 3:38 pm This jackmidi thing is a curse. Now setting up MIDI on Linux, which used to be fairly easy/straightforward), is getting as troublesome as setting up digital audio. Thank you guy-who-made-jackmidi for wrecking Linux some more. May bad luck follow you wherever you go.

My sincere advice to the OP is:

Whenever you come across a program that requires jack-midi, toss that program away. Don't use it. It was written by a programmer who lacks even the minimal competence to write software that uses the linux operating system's midi api. (And that's inexcusable since the alsa midi api is very simple.) Don't indulge bad programmers.
I feel you're really unhappy with jack-midi :(
But, what application can (for example) substitute qsynth (which is working fine with jack, I never got it configured using alsa midi) ?
I'm not depending on using jack-midi, if there's an alsa solution for my goal (see my all over Goal)
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 360 times

Re: basic questions about jack and midi

Post by j_e_f_f_g »

HarryR wrote: I never got qsynth configured using alsa midi)
QSynth works with ALSA (sequencer) MIDI API. I know because I've used it with my Roland and Yamaha keyboard controllers directly routed to qsynth (to play sfz instruments).

The problem with lots of linux software is that the software tends to use code written by different programmers who don't really work together. They use each others' code, but they have different approaches, and aren't coordinating to build one tightly integrated, stream-lined application. In the case of qsynth, it is separate from both the engine that plays the sfz files (Linuxsampler) and the daemon that routes/mixes audio data to your sound card (jack). So you have to setup this loosely coupled system in 3 parts.

If you want to run qsynth as a standalone software sampler, go into its "Add Devices" screen, and make sure you have 2 devices -- an audio device, and a midi device. Set the audio device to use jack. (Alternately, if you want to bypass jack and go direct to your audio out, select "ALSA" and enter your device number.) If you don't have a midi device listed, then add one. Set it to use "ALSA". Mark it as the default device.

Before you exit qsynth, save this configuration (to a .scp file). You may need to reload it someday.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 360 times

Re: basic questions about jack and midi

Post by j_e_f_f_g »

HarryR wrote: trigger, let's say a bank change or an effect like chorus ... My all over goal is, that kind of midi live setup is configured.
This means everything (whatever it is) is configured BEFORE starting to play live and while playing, changes are made
simply on /with keyboard.
As a gigging keyboardist who wrote his own software for live gigs, you must try BackupBand. What you describe above is exactly what it does.

See the link in my signature.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

tramp
Established Member
Posts: 2426
Joined: Mon Jul 01, 2013 8:13 am
Has thanked: 11 times
Been thanked: 545 times

Re: basic questions about jack and midi

Post by tramp »

HarryR wrote: Mon Jul 25, 2022 1:14 pm JACK-MIDI: : why are there two midi_captures ? midi_capture_1 is there by default (with no keyboard plugged in).
Where does it come from ?
HarryR wrote: Mon Jul 25, 2022 1:14 pm What/where the hell is midi_playback_* ?
That's the alsa midi through ports.
On the road again.
User avatar
Linuxmusician01
Established Member
Posts: 1632
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland (Europe)
Has thanked: 853 times
Been thanked: 161 times

Re: basic questions about jack and midi

Post by Linuxmusician01 »

j_e_f_f_g wrote: Mon Jul 25, 2022 3:38 pm This jackmidi thing is a curse. Now setting up MIDI on Linux, which used to be fairly easy/straightforward), is getting as troublesome as setting up digital audio. Thank you guy-who-made-jackmidi for wrecking Linux some more. May bad luck follow you wherever you go.

My sincere advice to the OP is:

Whenever you come across a program that requires jack-midi, toss that program away. Don't use it. It was written by a programmer who lacks even the minimal competence to write software that uses the linux operating system's midi api. (And that's inexcusable since the alsa midi api is very simple.) Don't indulge bad programmers.
First of all: what @j_e_f_f_g said above.
HarryR wrote: Mon Jul 25, 2022 1:14 pm [...]
ALSA-MIDI:

This shows the nearest to hardware (devices) ?!
There's my usb-midi-keyboard (MK-461C).
Left is the (readable) "device" which gives me midi events.
Right is the (writable) "device" which is kind of input for midi events on usb-midi-keyboard (MK-461C).
What the hell does this mean ?
If I think of a keyboard, this would mean my keyboard produces "char"-events and can read "char"-events,
which would be nonsense as it doesn't read.
So, can someone tell me what this means in terms of midi ?
You sort of answered your own question. ;) A Midi device can have Midi OUT and/or IN ports. In the old days, before computers and USB Midi, they would actually be two physical 5-pin DIN sockets marked IN and OUT. A computer can not make the distinction between the two. I don't know why: probably the digital Midi info sent by the port does not "say" if it's IN or OUT. That is: if a PC "sees" a Midi port (like the single one on your keyboard) it gives it a number (the number 0 in your case in the Alsa-midi tab of QJackctl). Because your computer does not know if it's IN or OUT it places said port of your keyboard in the 'Connections' window of Qjackctl twice. Once under IN and one under OUT. It is your responsibility to know if number 0 is IN or OUT so you can connect IN ports to OUT ports.

Example: I have a hardware synth that has two Midi ports: an IN and an OUT. Yep: I can play said synth with my computer. So my PC gives it two Midi numbers: 0 and 1. And it places those two on both sides of the 'Connections' window, see picture below. It's my responsibility to find out which number is IN and which is OUT.
Image

P.S. I could only find this info on your 'Evolution MK-461C' Midi keyboard

P.S.2 There's Pipewire now that's supposed to replace both PulseAudio and Jack. I hope that makes things easier for us...
j_e_f_f_g
Established Member
Posts: 2032
Joined: Fri Aug 10, 2012 10:48 pm
Been thanked: 360 times

Re: basic questions about jack and midi

Post by j_e_f_f_g »

linuxmusician01 wrote: what j_e_f_f_g said above.
what linuxmusician said above about what I said above.

Author of BackupBand at https://sourceforge.net/projects/backupband/files/
My fans show their support by mentioning my name in their signature.

HarryR
Established Member
Posts: 30
Joined: Thu Dec 22, 2016 2:10 pm
Been thanked: 2 times

Re: basic questions about jack and midi

Post by HarryR »

Hello again,

thanks for help :D

I close this thread, but don't be afraid, I have another bunch of questions and
will open new ones in new threads soon :lol:

Best regards
Harry
User avatar
RyanH
Established Member
Posts: 248
Joined: Fri Jul 08, 2022 7:58 am
Has thanked: 169 times
Been thanked: 45 times

Re: basic questions about jack and midi

Post by RyanH »

Here is some info that might be helpful:

QSynth - ALSA

To configure QSynth to use ALSA, go into Setup - MIDI tab - then under "MIDI driver" select alsa_seq. Then each QSynth preset that you have set to ALSA will show in the ALSA tab. If you set "MIDI driver" to Jack, it will show up in Jack's MIDI tab.

QSynth ALSA.png
QSynth ALSA.png (250.42 KiB) Viewed 1771 times
QSynth Jack ALSA.png
QSynth Jack ALSA.png (242.16 KiB) Viewed 1771 times
Last edited by RyanH on Fri Jul 29, 2022 6:37 am, edited 1 time in total.
User avatar
RyanH
Established Member
Posts: 248
Joined: Fri Jul 08, 2022 7:58 am
Has thanked: 169 times
Been thanked: 45 times

Re: basic questions about jack and midi

Post by RyanH »

Midi Through

You can plug multiple devices into MIDI Through in the ALSA tab and then use them in the MIDI tab.

Try this:

-unplug your keyboard and close all your software synths. Look at the MIDI tab. You will see 1 midi_capture and 1 midi_playback

-now plug your keyboard into your computer. You will now see 2 midi_capture and 2 midi_playback. Ignore the midi_playback. You don't need it for your synth

-if you use a software synth (like QSynth) with Jack, plug your keyboard into MIDI Through in the ALSA tab and then you can go to the MIDI tab and connect midi_capture_2

one keyboard, midi through.png
one keyboard, midi through.png (234.23 KiB) Viewed 1770 times

-if you want to use 2 keyboards with MIDI through, connect them both to the computer. You will now see 3 midi_captures. the first is the computer's, which is always there. The second is one of your keyboards. The third is your other keyboard. Connect both of your keyboards to MIDI Through in the ALSA tab, and now you can use them both in the MIDI tab.

ALSA tab,2 keyboards, midi through.png
ALSA tab,2 keyboards, midi through.png (232.83 KiB) Viewed 1770 times
MIDI tab,2 keyboards, midi through.png
MIDI tab,2 keyboards, midi through.png (227.75 KiB) Viewed 1770 times

Note: the numbering system for the midi devices in the MIDI tab is a bit crazy. You just have to remember which devices you plugged in and which one you plugged in first, second, etc.

I hope this helps!
HarryR
Established Member
Posts: 30
Joined: Thu Dec 22, 2016 2:10 pm
Been thanked: 2 times

Re: basic questions about jack and midi

Post by HarryR »

Thank you all for all the informations you sent.
My knowledge has been improved for a factor of 10 :D

There's one remaining question.

Is it possible to fix the name of midi_capture2 to one name ?

My intention for this question is to have something like
midiKeyboardInput instead of midi_capture2 (and its successors midi_capture3 .. midi_captureN after replugging ) ?

Best regards
User avatar
RyanH
Established Member
Posts: 248
Joined: Fri Jul 08, 2022 7:58 am
Has thanked: 169 times
Been thanked: 45 times

Re: basic questions about jack and midi

Post by RyanH »

Someone else may correct me on this, but this is my experience. You can change the name, but when you unplug your device and then plug in it again, it won't necessarily keep that name. Worse than that, you may plug in a different device and it will get the name midiKeyboardInput. I think it has to do with the order you plug them in. For example, if you have two devices plugged in and give device #3 a name, any device that is the third one you plug in will then get that name next time. That is why I try to use the ALSA tab instead of the MIDI tab, because the ALSA tab gives you the names of the devices and the software.

If you want to try changing the names, go to Setup, and in the Display tab, at the bottom left, check "enable client/port aliases editing (rename)".

Enable client port aliases editing.png
Enable client port aliases editing.png (218.03 KiB) Viewed 1740 times
Post Reply