TransWikia.com

Audio distorted on pulse/alsa, works fine on JACK. How to analyze why JACK works correctly and use that knowledge to fix pulse/alsa configuration?

Unix & Linux Asked by Jessica Nowak on November 28, 2020

To test and resolve this problem I am using a fresh install of Fedora 33, audio settings or configuration files left untouched.

By default the audio is heavily distorted (it is possible to make out what is being played, but overall it is not usable).

However when I install and start jackd and leave it running with the following settings:

jackd -r -dalsa -dhw:0 -r48000 -p256 -n2

and then try an audio file with mpv (which is able to use JACK), the sound is crisp and clear, working as intended:

mpv --ao=jack test.flac

Note: jackd with -r44100 works too.

This is of course not a satisfying general approach because not every software is able to use JACK by itself, so it doesn’t work with Firefox, for example.

Because JACK is able to handle things properly, I guess that either the pulse or alsa (automatic) settings are causing the problem? Or could it be something else?

In short: How can I replicate what JACK does using an ALSA configuration (or pulseaudio for that matter). A solution through ALSA would be preferred to make this answer work without pulse as well. It is of course also possible that pulseuadio is the part is causing the problem, I do not know.


Additional information:

  • Output of aplay -l:
**** List of PLAYBACK Hardware Devices ****
card 0: Studio [Audiofuse Studio], device 0: USB Audio [USB Audio]
  Subdevices: 0/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 0: ALC1220 Analog [ALC1220 Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: Generic [HD-Audio Generic], device 1: ALC1220 Digital [ALC1220 Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
  • Output of jackd -r -dalsa -dhw:0 -r48000 -p256 -n2:
jackdmp 1.9.14
Copyright 2001-2005 Paul Davis and others.
Copyright 2004-2016 Grame.
Copyright 2016-2019 Filipe Coelho.
jackdmp comes with ABSOLUTELY NO WARRANTY
This is free software, and you are welcome to redistribute it
under certain conditions; see the file COPYING for details
no message buffer overruns
no message buffer overruns
no message buffer overruns
JACK server starting in non-realtime mode
self-connect-mode is "Don't restrict self connect requests"
audio_reservation_init
Acquire audio card Audio0
creating alsa driver ... hw:0|hw:0|256|2|48000|0|0|nomon|swmeter|-|32bit
configuring for 48000Hz, period = 256 frames (5.3 ms), buffer = 2 periods
ALSA: final selected sample format for capture: 32bit integer little-endian
ALSA: use 2 periods for capture
ALSA: final selected sample format for playback: 32bit integer little-endian
ALSA: use 2 periods for playback
  • Output of aplay --dump-hw-params -D hw:Studio -t raw /dev/zero:
Playing raw data '/dev/zero' : Unsigned 8 bit, Rate 8000 Hz, Mono
HW Params of device "hw:Studio":
--------------------
ACCESS:  MMAP_INTERLEAVED RW_INTERLEAVED
FORMAT:  S32_LE
SUBFORMAT:  STD
SAMPLE_BITS: 32
FRAME_BITS: [320 576]
CHANNELS: [10 18]
RATE: [44100 192000]
PERIOD_TIME: [125 297211)
PERIOD_SIZE: [6 13107]
PERIOD_BYTES: [240 524288]
PERIODS: [2 1024]
BUFFER_TIME: (62 594422)
BUFFER_SIZE: [12 26214]
BUFFER_BYTES: [480 1048576]
TICK_TIME: ALL
--------------------
aplay: set_params:1343: Sample format non available
Available formats:
- S32_LE
  • Output of cat /proc/asound/Studio/stream0 (only "Playback"):
Playback:
  Status: Stop
  Interface 1
    Altset 1
    Format: S32_LE
    Channels: 18
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
    Bits: 24
  Interface 1
    Altset 2
    Format: S32_LE
    Channels: 18
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
    Bits: 24
  Interface 1
    Altset 3
    Format: S32_LE
    Channels: 10
    Endpoint: 1 OUT (ASYNC)
    Rates: 44100, 48000, 88200, 96000, 176400, 192000
    Data packet interval: 125 us
    Bits: 24
    Channel map: FL FR FC LFE RL RR FLC FRC RC SL

One Answer

I see, I tried converting the file myself using sox. What I got then was the following error: Playing WAVE 'CONVERTED-test.wav' : Signed 32 bit Little Endian, Rate 44100 Hz, Stereo aplay: set_params:1349: Channels count non available. Using channels 18 with the sox command then finally makes aplay play the file properly and clear! Note: When I convert the file using sox with channels 10 the file is played by aplay too, however in that case the file is again distorted. Any other number for channels will result in the channels count non available error.

So it looks like the interface with 10 channels has a bug in the driver or somewhere else, and you need to convince Pulseaudio to use the interface with 18 channels.

Looking at module-alsa-sink, you can put it an ALSA device.

Which probably means you need to do the configuration in ~/.asoundrc.

You configure the number of channels in the hw plugin, but I've never done this myself, and I don't have hardware with those channel choices.

So I guess this will need some experimentation with the various configuration files. This is hard to do remotely, and I cannot give you step-by-step instructions.

Another option would be to file a bugreport on the ALSA tracker. They might find out the problem in the driver (which probably needs a quirk, if it's the generic USB driver), or give you advice how the configuration files would look like.

ALSA Bug tracking is explained here.

Correct answer by dirkt on November 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP