Trouble setting up MIDI Controller with PipeWire

Hello,

Newbie here trying to set up MIDI keyboard controller in Ardour. I’m working on a Debian 12 with Pipewire:

PulseAudio (on PipeWire 0.3.65)

When I select ALSA after configuring Audio/MIDI Setup option I can see MIDI keyboard option when configuring a MIDI Track. Ardour is able to catch activity but I cannot hear anything. When I check qpwgraph no Ardour box is there. Ardour logs show the following message:

2023-05-14T17:02:23 [ERROR]: AlsaSeqMidiIO: Device initialization failed.
2023-05-14T17:02:23 [WARNING]: AlsaMidiIn: failed to open midi device '144:0'.

I’ve tried the same using Pulseaudio instead. But no MIDI keyboard is found. However, when checking qpwgraph this time Ardour box exists, only a few ports though (nothing to do with the number of ports that I have seen in other images). And of course now I can hear sound coming from Ardour.

Ardour version: 7.4.0

Any help is welcome.

Thanks!

Lots of details to cover, so I will try to go one at a time.

Usually ALSA is the easiest and least trouble backend to use, however there are some relevant details you did not add initially that are relevant to the audio setup.

It appears from your included picture of the Pipewire graph at the end of your post that you are using Bluetooth headphones as your audio device. Ardour does not support Bluetooth devices, so that would explain why you cannot hear anything. To use Bluetooth headphones you will have to use Pipewire, which for Ardour means making sure pipewire-jack is installed (may have a slightly different name depending on your distribution) and using the JACK backend for the Ardour audio connection.

What audio device did you configure when you configured your USB keyboard as the MIDI source? My first suspicion would be that you chose some audio device built in to the motherboard, which may have meant that the audio was being sent to a headphone jack which you were not using.

These two messages seem to imply opposite things:

Meaning you are able to record MIDI notes in an Ardour MIDI track?
That seems surprising if these messages refer to the MIDI interface you are attempting to use:

If device initialization failed it seems that Ardour would not have been able to record MIDI data (assuming that is what you meant by “catch activity”).
Pipewire does support MIDI, so when you verify that pipewire-jack is installed and use the JACK backend of Ardour you will use pipewire for routing the MIDI data as well as audio data.

The pipewire graph shown in your post indicates that the Bose headphones are connected as mono. Bluetooth also adds additional latency in the audio path, so is not ideal for monitoring music production. The mono connection can probably be fixed (i.e. connected as stereo) with a change to the bluetooth connection settings, but the additional latency is inherent to the way bluetooth headphones work. It may or may not bother you for what you are trying to do, just something to be aware of.

Thanks for your detailed answer.

By using my wired headphones I have been able to hear input from my MIDI device using ALSA as Audio System. However now I have two problems:

  • output device is displayed as “Dummy Output” as you can see in the image
    image
  • I can’t turn the volume down or up (I assume as a consequence of previous bullet point)

When I try to use JACK as Audio System Ardour keeps loading forever. I have installed pipewire-jack, have I configure it as well?

OK, that is good, it confirms you are using the correct audio device.

That is the output device of Pipewire. Since you are using the ALSA backend for Ardour, Ardour requested exclusive use of the audio device, so Pipewire creates a dummy device to use for routing while Ardour is using the physical audio interface.

When using the ALSA backend there is no utility to looking at anything in Pipewire, it is not relevant at all.

When using the ALSA backend you should use the Ardour monitor section to control volume (assuming you are not using some external device with level control, such as an external audio interface with headphone level control).

If using pipewire-jack as a JACK audio server then Ardour should be able to use the JACK API for routing audio and MIDI, but you have to configure Pipewire to use the audio devices you want first.
But Ardour should load in a reasonable amount of time, whether the device is configured as you want or not Ardour should still connect to Pipewire JACK server and begin running.

What is your goal in using pipewire-jack? Are you trying to get Bluetooth headphones working again? Or do you need to application-to-application routing capabilities?

1 Like

It’s recommendable to use Pulseaudio instead of Pipewire, Pipewire is an ingenious project, but is to early to use it as a main audio backend, because it is not 100% stable and vast majority of Linux audio software is not coded to work flawlessly with it.

1 Like

Actually ALSA is generally the better recommendation. Pulse isn’t really a great system for professional audio in general.

Seablade
2 Likes

ALSA is good for all gear round applications, but the latency isn’t reasonable for audio production.

1 Like

You have the Linux audio systems quite mixed up, I’m afraid.

ALSA and JACK are the two systems currently recommended for audio production in Linux.
Pulseaudio is a fallback, only intended to being used for mixdown and, more or less, only if you for some reason can’t use one of the aforementioned.

PipeWire is a work-in-progress which currently works well for some workflows and less well for others.

4 Likes

Actually I just wanted to make it work so that I could start using Ardour, with not specific goal. Really helpful all the comments, now I have a much clearer idea of how the pieces are connected. Thank you!

1 Like

Yeah, you’re right, what I’m trying to explain that with ALSA alone you have many xruns and in JACK-PULSE connection you have less or none, however I see a great future to PIPEWIRE, is a good audio ecosystem. Other thing curlsei can do is to try using ALSA-RAW midi option

This makes no sense. Pipewire (or JACK) uses ALSA under the hood.

Chances are that you use pipewire with a much larger buffersize. If you use the same settings with Ardour/ALSA you will even get better performance since piewire and JACK does add overhead.

2 Likes

Thanks! I’m learning a lot in these forums :+1:

Pipewire is by default a lot more forgiving, with a much longer latency (which explains why you have fewer dropouts). Sadly at this point in time it is still quite hard to properly configure it for pro-audio.

If you want to dig deeper, you can compare, the kernel device driver settings.

Open a terminal window and run the following command

cd /tmp && wget https://community.ardour.org/files/adevices.sh && bash ./adevices.sh

It will not modify your system; it lists all soundcards, their current settings and applications using them, etc.

Here I get with pipewire (default settings)

* Playback Device 0:
[...]
      channels: 2
      rate: 48000 (48000/1)
      period_size: 1024
      buffer_size: 8192   // <<<  8192 / 48000 = 170ms latency

While with Ardour/ALSA:

* Playback Device 0:
[...]
      channels: 2
      rate: 48000 (48000/1)
      period_size: 512
      buffer_size: 1024   // <<<   1024 / 48000 = 21ms latency

That requires exclusive access to the device. Only one application can use it at any given time. In general is is preferable to use ALSA-Sequencer for that reason.

2 Likes

Wow, so ALSA is the audio backend base, and Pulse, Jack and Pipewire are audio servers or intermediates?

Yes, ALSA is interface to the kernel-driver.

The problem with ALSA (or most low-level drivers, ASIO on Windows has the same issue) is that only one application at a time can use the soundcard.

The solution is to add a “sound-server” on top of ALSA (and there is quite some historical baggage of those).

In the last decade there were two:

  • Pulseaudio (desktop sound system, no MIDI)
  • JACK (pro-audio)

More recently PipeWire came along which aims to unify (and hopefully supersede) the two.

2 Likes

Here’s a good graph with explanation, showing where in the stack the different audio layers are

1 Like

Ooook!, it’s like Alsa have only two cables connected to the soundcard, and Jack, pulse and PW are like virtual mixers and snakes to use more than one device, in this case ASIO is a child compared to these audio servers.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.