You are not logged in.

#1 2024-02-12 16:01:40

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Problem with "alsa direct" and Dac

Linux doesn't seem to get along very well with my Teac UD 503, while I have no problems with the integrated sound card.
I have a very strange problem, which occurs when I use an application like strawberry, which is able to access the hardware directly (hw:0,0) via alsa.
I have no problem playing 44100 hz 16 bit flac files, but I have difficulty playing tracks at a higher bit rate. If, within the program, I switch from a 44100 track to one of 96000 Hz (or more) I have no problem but, if I try to change the track again and select another one of 96000 Hz or higher, I get this error:

Unable to get/adjust resource settings.

../gstreamer/subprojects/gst-plugins-base/ext/alsa/gstalsasink.c(639): set_hwparams (): /GstPlayBin3:pipeline-3-pipeline/GstPlaySink:playsink/GstBin:abin/GstBin:audiobin/GstAlsaSink :pipeline-3-alsasink: Unable to set hw params for playback: Device or address does not exist

How do I "solve" it? I select a 44100 Hz track, and then I go back to the 96000 Hz track I wanted to listen to.
The DAC plays tracks up to 384000 Hz. The problem is not the DAC.
If I listen to an entire album at 96000 Hz, track after track, I have no problem. The problem occurs when manually switching from one track to another, and only above 44100 hz. It's as if it were a resource availability problem.

I hope I managed to make myself understood. It would be difficult to explain even in my language.

Offline

#2 2024-02-12 16:33:46

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: Problem with "alsa direct" and Dac

The problem here is that direct access can only work on a single sample rate at a time and depending on what your player is doing it might not properly stop and switch so the new params can take effect.

Do you really actually need that and why can you not play back things via pulseaudio all the time? Chances you're actually hearing the sample rate differences for listening purposes are slim to not possible.

You can configure the "avoid-resampling = true" option in your /etc/pulse/daemon.conf to make pulse try and retain sample rates when feasible (nothing else is playing and the DAC supporting the sample rate) https://wiki.archlinux.org/title/PulseAudio#daemon.conf

Last edited by V1del (2024-02-12 16:45:16)

Offline

#3 2024-02-12 16:46:31

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

I've been thinking about something like this, and I guess there's no solution. It actually seems like a problem of "times" of passage from one frequency to another, even if this only happens above 44100 hz. If I switch from one track at 96000 Hz to another with the same bitrate the problem occurs the same.
Pulseaudio? As far as I know it worsens the sound quality, acting as an intermediary, but I should do some testing. I have already set some parameters in daemon.conf to improve the quality, but some things are still not clear to me.
Question: Unfortunately I didn't create a daemon.conf.old before I started editing the original file. I don't know that this file is available online and is the same in all distros based on the same version of pulse. Can you advise me?
Thanks again for your support!

Offline

#4 2024-02-12 16:48:55

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

I just read your edited post! I'll try to do as you say!

Offline

#5 2024-02-12 17:29:26

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

The "avoid resampling" option works, but unfortunately audio with tracks above 44100 hz does not work. The program just can't open them.

Offline

#6 2024-02-12 17:35:27

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

I'll show you the output of the strawberry error, when I try to select a track above 44100 hz with pulse audio:

18:31:44.614 ERROR OVHLyricsProvider:111 OVHLyrics: "No lyrics found"
18:32:06.567 ERROR MusixmatchLyricsProvider:404 MusixmatchLyrics: "Error transferring https://www.musixmatch.com/lyrics/ac-dc/rock-n-singer - server replied: (203)"
18:32:06.567 ERROR OVHLyricsProvider:111 OVHLyrics: "Error transferring https://api.lyrics.ovh/v1/AC-DC/Rock%27N%27Singer - server replied: Not Found (203)"
18:32:06.567 ERROR OVHLyricsProvider:111 OVHLyrics: "No lyrics found"

The problem only occurs with the DAC, not with the integrated sound card. Am I supposed to think there is something wrong with Alsa and this device?

Offline

#7 2024-02-12 18:01:46

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: Problem with "alsa direct" and Dac

Those have no relation to playback, what does

journalctl -b --user-unit pulseaudio 

say?

Offline

#8 2024-02-12 20:00:33

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

journalctl -b --user-unit pulseaudio 
feb 12 20:57:41 archlinux systemd[1208]: Starting Sound Service...
feb 12 20:57:46 archlinux pulseaudio[1639]: Failed to load module "module-alsa-card" (argument: "device_id="3" nam
e="pci-0000_75_00.6" card_name="alsa_card.pci-0000_75_00.6" namereg_fail=false tsched=yes fixed_latency_range=no ignore_dB=no deferred_vol
ume=yes use_ucm=yes avoid_resampling=yes card_properties="module-udev-detect.discovered=1""): initialization failed.
feb 12 20:57:46 archlinux systemd[1208]: Started Sound Service.
feb 12 20:58:34 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:35 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:35 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:36 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:36 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:37 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:37 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:38 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:39 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:39 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:40 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:40 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:41 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:41 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:42 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:42 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:43 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:44 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:44 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:45 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:45 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:46 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:46 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:47 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:50 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:50 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:51 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:51 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:52 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:53 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:53 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:54 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente
feb 12 20:58:54 archlinux pulseaudio[1639]: Failed to set hardware parameters: Device o indirizzo non esistente

Offline

#9 2024-02-15 12:30:58

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: Problem with "alsa direct" and Dac

Mhm... all of that reads like your DAC is simply quite slow in switching rates and this trips up things.

I'd say it would be easiest to simply take "the hit" and just setup a standard rate you know works well and let the sample rate converters do their job. As mentioned, it's quite unlikely (would be a bug in the rate converter) that this will be actually audible by you.

Offline

#10 2024-02-15 15:49:04

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

A thousand thanks!
I'm using pulseaudio with the best settings I could give it by editing daemon.conf. As for frequencies, I chose 44100 Hz as the default sample rate and 192000 as the alternate sample rate. However, the overall quality is good.

Offline

#11 2024-02-15 23:52:04

vikingo90
Member
Registered: 2024-02-08
Posts: 26

Re: Problem with "alsa direct" and Dac

V1del wrote:

Mhm... all of that reads like your DAC is simply quite slow in switching rates and this trips up things.

I'd say it would be easiest to simply take "the hit" and just setup a standard rate you know works well and let the sample rate converters do their job. As mentioned, it's quite unlikely (would be a bug in the rate converter) that this will be actually audible by you.

I believe the problem you are referring to has been reported and resolved by someone, but I could be wrong:

https://scm.linefinity.com/common/linux … 6e57cbea9a

What do you think about it? It is a downloadable .c file, but I don't know what to do with it, that is, how to obviously integrate it into the system.

Offline

#12 2024-02-16 12:25:50

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 23,447

Re: Problem with "alsa direct" and Dac

That was 10 years ago, that patch is part of the current kernel guaranteed. but maybe something regressed here since.

Edit: Checking the present, it and some other quirks should get applied already: https://github.com/torvalds/linux/blob/ … ks.c#L1840 but FWIW, which vid:pid do you have? Output of lsusb from usbutils?

Last edited by V1del (2024-02-16 13:30:49)

Offline

Board footer

Powered by FluxBB