ALC1220 playback problem with Ardour

Hi - I’ve been having a terrible audio distortion issues when I feed live MIDI into Ardour and try to output it on the built-in audio (ALC1220) in my Linux PC. I just recently discovered that increasing the buffer size to 4096 samples (92.9 ms) resolves the problem, although it adds a lot of delay. However when I feed the same live MIDI into Ardour and output it to my Scarlett 2i2, it works fine all the way down to 256 samples (5.8 ms).

My question: is there any way I can get the built-in audio to be as responsive as the Scarlett 2i2? I have a decent CPU (AMD 3700x) with all 12 cores set to “performance” mode, but that doesn’t seem to help at all. Any suggestions?

Thanks, Ken

Is the I/O system overloaded? Have a look top-right in Ardour’s status-bar, if there are dropouts (the number in brackets after the DSP load): image

All in all it is not a big surprise that a consumer soundcard cannot deal with low latency, but on most systems, onboard soundcards can reliably handle at 20ms chunks (1024 samples/ 48kHz).

Could it be that the soundcard shares an IRQ with some other device? WIFI perhaps? When some other device hogs the bus, blocking the soundcard for a long time that could explain this. You could try to disable the other device(s). Check if disabling WIFI or Bluetooth etc helps. If so you can perhaps use rtirq to prioritize the soundcard over other devices.

What GNU/Linux distro are you using? Perhaps try a pro-audio tailored one that comes with tweaks. Maybe try http://www.bandshed.net/avlinux/ (also runs live from USB-key) for a 2nd opinion.

CPU power is rarely the bottleneck. It’s usually I/O that’s the problem with real-time performance.

Thanks Robin, that’s really helpful! I haven’t had time to look into all of your suggestions yet, but I did boot up avlinux on a USB key and got much improved, but still not great, latency on the internal sound card (~40 ms). I’m thinking this is probably an upper limit for my system, as avlinux seems to have every kernel tweak available.

To answer your followup questions, I’m running Pop_OS 19.10 (Ubuntu derivative), and the DSP load on Ardour is typically under 10-15%.

One thing I’m trying to understand is why my Scarlett 2i2, connected via USB2, has so much better latency than my internal sound card. For both cases, I gather these two steps have to be performed:

  1. The MIDI keystroke is received by ALSA via USB2
  2. The keystroke is sent from ALSA to Ardour, which converts it to a digital waveform

After this, for the Scarlett:

  1. The digital waveform is sent by Ardour to the Scarlett 2i2 via USB2
  2. Scarlett passes the digital data through a D/A converter

And for the internal sound card:

  1. The digital waveform is sent from Ardour to ALSA
  2. ALSA passes the digital data to the internal sound card
  3. The internal sound card passes it through a D/A converter

I’m just trying to figure out why data that never leaves the motherboard would be so much slower than the same data sent by USB - I would have expected just the opposite. But perhaps it’s as you suggested, an interrupt issue that’s not allowing the internal sound card to respond in a timely fashion. I will continue to research this.

Thanks again for your help!

Ken

Just a small correction to your description for the Scarlett. I/O happens via ALSA as well.

User-space applications (Ardour, JACK, etc) interact with ALSA (Advance Linux Sound Architecture - kernel drivers) for all sound-cards (USB, internal/PCI[e], firewire [1]).

From Ardour’s perspective there is no difference if Ardour uses the Scarlett or the ALC.

[1] Only Bluetooth is not covered by ALSA ,and in the past firewire was also special-cased.

Some background information, a long but good video explaining the underlying issue: