You are not logged in.

#1 2020-05-25 16:06:20

stefano
Member
Registered: 2011-04-09
Posts: 258

Alsa/jack only outputs clipped/distorted sound

I am switching from a Alsa/Jack/Pulseaudio setup to Alsa/Jack only in order to use ardour/musescore and other music production apps that need to be interconnected to each other.

My previous setup worked ok for sound out and in---apps like clementine, zoom, audacity, etc., had no issues. Unfortunately I cannot get any of them to work again in the new setup. In fact, I cannot get any decent sound out.

Here is what I did:

1. Stopped pulseaudio completely (masked it in systemctl, set autorespawn to "no") as suggested in the wiki

2. Used cadence to switch the  jack/alsa setup to use the alsa-jack plugin bridge instead of the alsa-pulseaudio-jack plugin

3. Checked that jack's setting were as recommended on the jack's page on the wiki, including selecting the right audio interface

At this point i just tried to see if alsa was working correctly with the speaker-test command

speaker-test -c 2

And the result was negative. I did get sound out, but instead of the expected pink noise I got a higher pitched, clipped and pulsating sound (properly panned from left to right).
I got the same kind of distortion in the apps that were now routing sound out through jack--> alsa (e.g. clementine, audacity). I could still use them if I stopped jack and tell them to use alsa directly, which indicates, I think, the problem is not with alsa per se, but with the alsa-jack connection.

I then tried the GUI-less tack. Stopped everything in cadence (jack, bridge, etc) and went through the cli jack configuration recommended in the wiki jack page, one line at the time. I did not get any error, but the result were similar. I tried to test the speakers and got a negative result (no sound):

speaker-test 1.2.2

Playback device is default
Stream parameters are 48000Hz, S16_LE, 2 channels
Using 16 octaves of pink noise
ALSA lib pcm_dmix.c:1089:(snd_pcm_dmix_open) unable to open slave
Playback open error: -16,Device or resource busy

This is perhaps to be expected---the sound output is receiving input from jack through the alsa-jack bridge, so it comes out as busy? That would be my guess, based on a still rudimentary understanding of the linux audio architecture. The other apps I tried produced the same clipped/high-pitched output as before (clementine, audacity), or no output sound at all   (ardour, musescore), even though the patchbay in catia/qjackcktl showed they were connected to "system/playback".

So my guess is that the jack configuration is not correct for my system, but I am struggling to understand what I'm doing wrong. The clipping/distortion may indicate that the hardware is not keeping up with the jack server demands, perhaps? But for such simple tests, there should be no hardware problems. I am running a decent, although now old, Dell T3600 workstation.

Offline

#2 2020-05-25 16:19:13

stefano
Member
Registered: 2011-04-09
Posts: 258

Re: Alsa/jack only outputs clipped/distorted sound

More info: it seems indeed to be an overload issue. qjackctl shows a lot of XRUNs. I am not quite sure where to check the load at rest in Qjackctl, but if it is the % number on the top line, it oscillates between 2% and 4%.

Last edited by stefano (2020-05-25 16:19:31)

Offline

#3 2020-05-25 16:19:20

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 21,740

Re: Alsa/jack only outputs clipped/distorted sound

cadence terminal logs? You will FWIW generally want to install realtime-privileges and add your user to the resulting realtime group. Also you probably should have some alsa configs as a result of these attempts you might want to post these.

Offline

#4 2020-05-25 16:27:15

stefano
Member
Registered: 2011-04-09
Posts: 258

Re: Alsa/jack only outputs clipped/distorted sound

V1del wrote:

cadence terminal logs? You will FWIW generally want to install realtime-privileges and add your user to the resulting realtime group. Also you probably should have some alsa configs as a result of these attempts you might want to post these.

Yeah, I had added myself to the realtime group, I forgot to mention that. 


here is the cadence log from a fresh restart of jack

Mon May 25 11:24:32 2020: Starting jack server...
Mon May 25 11:24:32 2020: JACK server starting in realtime mode with priority 10
Mon May 25 11:24:32 2020: self-connect-mode is "Don't restrict self connect requests"
Mon May 25 11:24:33 2020: Acquired audio card Audio2
Mon May 25 11:24:33 2020: Acquired audio card Audio0
Mon May 25 11:24:33 2020: creating alsa driver ... hw:PCH,0|hw:C920,0|64|2|48000|0|0|nomon|swmeter|-|32bit
Mon May 25 11:24:33 2020: configuring for 48000Hz, period = 64 frames (1.3 ms), buffer = 2 periods
Mon May 25 11:24:33 2020: ALSA: final selected sample format for capture: 16bit little-endian
Mon May 25 11:24:33 2020: ALSA: use 2 periods for capture
Mon May 25 11:24:33 2020: ALSA: final selected sample format for playback: 32bit integer little-endian
Mon May 25 11:24:33 2020: ALSA: use 2 periods for playback
Mon May 25 11:24:33 2020: ERROR: playback and capture sample rates do not match (44100 vs. 32000)
Mon May 25 11:24:33 2020: port created: Midi-Through:midi/playback_1
Mon May 25 11:24:33 2020: port created: Midi-Through:midi/capture_1
Mon May 25 11:24:33 2020: graph reorder: new port 'system:capture_1'
Mon May 25 11:24:33 2020: New client 'system' with PID 0
Mon May 25 11:24:33 2020: graph reorder: new port 'system:capture_2'
Mon May 25 11:24:33 2020: graph reorder: new port 'system:playback_1'
Mon May 25 11:24:33 2020: graph reorder: new port 'system:playback_2'
Mon May 25 11:24:33 2020: graph reorder: new port 'system:midi_capture_1'
Mon May 25 11:24:33 2020: graph reorder: new port 'system:midi_playback_1'

The DSP load rate hovers around 1.4% and the XRUNs are out of control

Offline

#5 2020-05-25 23:06:17

stefano
Member
Registered: 2011-04-09
Posts: 258

Re: Alsa/jack only outputs clipped/distorted sound

I eventually figured out what the problem with XRUN was: using two different interfaces for input and output. Once I set both of them to the main sound interface, XRUNs disappear if I keep buffer size at 256 and repeats at 2. That gives me a latency of 5.2 ms, which I may be able to live with.

What I would now like to understand is how I connect the USB microphone that I had previously configured as jack input? There must be something I'm missing about jack configuration.

Offline

Board footer

Powered by FluxBB