Midi Issues Jack/Pulseaudio/Alsa the entire baitball

Optimize your system for ultimate performance.

Moderators: MattKingUSA, khz

Post Reply
retnev
Established Member
Posts: 157
Joined: Sat Mar 25, 2017 2:13 am
Has thanked: 4 times
Been thanked: 3 times

Midi Issues Jack/Pulseaudio/Alsa the entire baitball

Post by retnev »

I had to move from AV Linux as it has no functional usergroup and there are unresolvable issues.
I moved to MX18 which is a well supported/ probably best supported Debian distro.

Pulseaudio is working great running all my remote devices such as tablets and all bluetooth audio and does my audio libraries well.

I have a lot of remaining questions though.

This post will only deal with getting MIDI working on MX18 (Debian Stretch).
I have decvices that are recognised but some applications dont see them.

The problem is seemingly with the humungously vague alsa/jack engine. Nobody I speak to knows of any cohesive procedure or manual to deal with the jack behemoth and all its idiosyncrasies.

1) The first question would be to ask for help about how to understand the midi system in Linux and how I can get to a stage that I can route midi optimally and LOGICALLY rather than to rely on heresay. There is no cohesive documentation addressing MIDI for Linux I could find. All just hand waving and trophy reports of no value.

How should I go about to get for example,
My motif XS8 keyboard to connect with midi to an internal synth or some application or software keyboard that will play voices off the Motif XS8? That way I can start building up some route of working pathways through the jack/alsa nightmare.

At the moment the Motif XS8 keyboard shows up as a midi device in vmpk, but selecting the same output soundcarrd as pulse works with successfully, and selecting the Motif XS8 as midi input, nothing happens.
I dont know where to even begin with this.
Lyberta
Established Member
Posts: 681
Joined: Sat Nov 01, 2014 8:15 pm
Location: The Internet
Been thanked: 1 time

Re: Midi Issues Jack/Pulseaudio/Alsa the entire baitball

Post by Lyberta »

Linux kernel has ALSA and ALSA has MIDI support in it. JACK can run on top of ALSA and has its own MIDI layer. When running, JACK will assume total control of audio but not MIDI. Most pro audio applications use JACK for audio but MIDI support is a bit split between ALSA and JACK.

When working with JACK you have to route everything manually. This is done to give you full control. You won't get any sound until you manually route your synth to the sound card. You can use QJackCtl to route audio and MIDI, both ALSA and JACK flavor. Keep in mind that usually MIDI keyboards expose only ALSA MIDI and if you synth only accepts JACK MIDI, you will have to convert it. I use a2jmidid for that.
User avatar
khz
Established Member
Posts: 1648
Joined: Thu Apr 17, 2008 6:29 am
Location: German
Has thanked: 42 times
Been thanked: 92 times

Re: Midi Issues Jack/Pulseaudio/Alsa the entire baitball

Post by khz »

Image
Picture from: Ted's Linux MIDI Guide >> http://www.tedfelix.com/linux/linux-midi.html

# ==> Do you use a sound server? If so, which one? Several? >> viewtopic.php?f=27&t=18864
  • Alsa2jack (MIDI):
    install:

    Code: Select all

    a2jmidid
    Setup >> Options >> [X] Run script after startup

    Code: Select all

    sleep 5 && a2jmidid -e &
    • # sleep - delay a specified time period

      Setup >> Settings >> Parameters >> MIDI Drivers [none]
      Setup >> Miscellaneous >> [ ] ([none]) Provide support for ALSA sequencer
. . . FZ - Does humor belongs in Music?
. . GNU/LINUX@AUDIO ~ /Wiki $ Howto.Info && GNU/Linux Debian installing >> Linux Audio Workstation LAW
  • I don't care about the freedom of speech because I have nothing to say.
User avatar
Linuxmusician01
Established Member
Posts: 1524
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland
Has thanked: 756 times
Been thanked: 135 times

Re: Midi Issues Jack/Pulseaudio/Alsa the entire baitball

Post by Linuxmusician01 »

@ retnev: I'd forget about the theory if I were you. I'd just try to get it working. As far as I know Linux works with Midi just like Windows, MacOS or Android. I'm also confused every time 'bout all the numbers and technical mumbo jumbo concerning Midi. What the hell is MSB and LSB? When is something an input and when output? How to I get sound out of a midi instrument via my computer? Sometimes I see my synths reacting to what I o on my computer yet I don't hear any sound!

Firstly, you assume that we know a lot more 'bout equipment and Linux than we actually do (tongue in cheek) :wink: . Let me list a few thing that I had to google:
  1. MX is a Debian based distribution. Do not take the following personally :). Maybe it's me, but I always thought that Ubuntu was the most used Debian based Linux distro.
  2. Motif XS8 is a synthesizer by Yamaha. It has midi and from your post I think that it can be used as a midi keyboard on a computer (i.e. not as a synth).
  3. Judging from your post I think that said midi keyboard/synth can also be controlled/played via midi (for instance via a computer). Realize the these are two completely different things!
  4. I think that you are trying to do both, but I don't know for sure.
  5. VMPK is the application Virtual Midi Piano Keyboard. Never heard of it, thanks for the tip!
I don't know if you (want to) use a DAW (digital audio workstation like Ableton Live etc.) to record anything. I'll assume for the moment that, to begin with, you simply want to use the synth as a midi keyboard to play a virtual synth on your computer. And, secondly, that you want to play said synth via your computer. Am I right?

1. Midi
Like I said Midi works in the same confusing manner on all operating systems. You connect a Midi input from one (virtual) device to a Midi output of another (virtual) device to control/play/operate it. That does not necessarily mean that after said connection you actually hear sound coming from your speakers (!). One operates something with Midi in the digital sense. Which has nothing to do with sound, which is analogue. At least, that's the not-so-professional way that I explain it to myself.

2. Jack
Why o why does one have to use Jack on Linux? I don't know. It's the same thing as asking why you have to use ASIO on Windows and asking how MidiOx works on Windows. I've accepted, after a long session of mindfulness, that we do. Now a days one does not have to stop/kill Pulseaudio to work with Jack . Simpy start it. I start Jack NOT via Qjackctl but simply from the command line:

Code: Select all

 jackd -d alsa --device hw:0
If you have two soundcards in your system and you want to use the second one instead of the first you change the 0 in the above command into a 1 like so:

Code: Select all

 jackd -d alsa --device hw:1
I've written a shell script that I use myself to "do some things" audio and Midi. You can get it here on pastebin.

3. Play a virtual synth with a physical Midi keyboard, using Carla
Now Jack comes in handy. What we have to do is to connect (via midi) a physical midi keyboard to a virtual synth on the computer. After this, we need to actually get sound out of the speakers connected to our computer!

I wouldn't use VMPK for this. I'd rather learn how to use Carla because chances are that you'll need that application a lot. Carla is an application that can load virtual instruments. One can install Carla via the famous and very, very, needed KXStudio repository for Debian based systems. See this page on how to do that. And yes: I know that's another hoop to jump through. But I'm afraid you'll have to. Okay?

Connect your keyboard to your PC and start Carla (assuming you started Jack). Again, we need to jump through some hoops (once): we need to configure Carla. Click "Settings -> Configure Carla". In the Canvas section select 'Auto hide groups with no ports'. In the Engine section choose under 'Audio driver' the option 'Jack with Alsa-Midi'. There's something querky 'bout Jack you should know: it has "its own" version of Midi that I never use. We usually use Alsa's Midi (Alsa is the sound driver from Linux, Jack is a layer on top of it).

We need an actual synth to control with our Midi keyboard. Let's use Carla's Nekobi for that. Click on the button "Add plugin" and pray that you can find Nekobi in there somewhere. Double click it.

Now and only now can we finally connect our physical keyboard, our virtual synth and our speakers (read: route sound to our sound card/audio device). Click on the tab called 'Patchbay'. You're on the "canvas" now. Click in the pull-down menu on "Canvas -> Zoom -> Auto fit". Use the mouse to click and drag your midi keyboard's "readable midi port" to Carla's "midi in" (this is the virtual connection of your keyb. to the synth). Now connect Carla's audio out to Playback (this is the connection of Carla to your sound card & speakers). If you're lucky then it'll look something like this (my Midi keyboard is the Yamaha Reface YC):

Image

I tried to do the same thing w/ VMPK but I could not get any sound out of my speakers...

4. Use computer to play physical midi synth
We'll do that some other time, just start w/ the above.


Oomph! That was complicated, now wasn't it? Well, that's because today you learned something about Midi as well as from the Lunux system. Basic Linux skills like knowing how to use the command line and how to execute shell scripts helps a lot. In my opinion one has to configure a lot of connections no matter what OS or DAW one uses. I hope you succeeded.

Good luck! :)
User avatar
Linuxmusician01
Established Member
Posts: 1524
Joined: Mon Feb 23, 2015 2:38 pm
Location: Holland
Has thanked: 756 times
Been thanked: 135 times

Re: Midi Issues Jack/Pulseaudio/Alsa the entire baitball

Post by Linuxmusician01 »

P.S. Another tip about Jack and Midi. An application that Linuxers use a lot is qjackctl. When you activate the "Connections" windows it looks like this:
Image
I always wondered why my Midi connections are under the "Alsa" tab and not simply under the "Midi" tab. That's because "Jacks own Midi" or midi connections that are routed via Jack are under the Midi tab. The Midi "things" that are handled by Alsa (which usually is everything Midi!) are under and "Alsa" tab. Nice, isn't it?
Post Reply