Issues with Alsa and music players Deadbeef & Audacious

Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

Hi
I am relatively new to Linux so I would appreciate any help/advice with regards to getting the best audio from my rather old system. I want to be able to play PCM as flac and DSD (although that is probably a separate issue). My flac files are both red book 16/44.1 and higher res up to 24/192. I have a USB DAC (Ifi Zen Dac) which is recognised by the OS. The playback issues occur with both the on-board audio card and the external USB DAC. I can play all files using Audacious even .dff but only with Pulse. Changing to Alsa generates an error message: "ALSA error: snd_pcm_open failed: Device or resource busy".

With Deadbeef I can play flac with Pulse but not .dff. With Alsa It plays sometimes but often it just displays the file info and "Stopped". On other occasions it will play flac at the wrong pitch - 16/44.1 too fast and higher res eg 24/96 far too slow. My aim is to get Deadbeef to work perfectly with Alsa to obtain a bit-perfect playback system. Any help greatly appreciated.

Code: Select all

system:    Host: GA-MA790FXT-UD5P Kernel: 5.3.0-62-generic x86_64 bits: 64 compiler: gcc v: 7.5.0 Desktop: Cinnamon 4.4.8 
           Distro: Linux Mint 19.3 Tricia base: Ubuntu 18.04 bionic 
Machine:   Type: Desktop Mobo: Gigabyte model: GA-MA790FXT-UD5P v: x.x serial: <filter> BIOS: Award v: F8n date: 01/07/2011 
CPU:       Topology: Quad Core model: AMD Phenom II X4 955 bits: 64 type: MCP arch: K10 rev: 2 L2 cache: 2048 KiB 
           flags: lm nx pae sse sse2 sse3 sse4a svm bogomips: 25716 
           Speed: 3200 MHz min/max: 800/3200 MHz Core speeds (MHz): 1: 3200 2: 800 3: 800 4: 800 
Graphics:  Device-1: NVIDIA GP107 [GeForce GTX 1050 Ti] vendor: eVga.com. driver: nvidia v: 435.21 bus ID: 01:00.0 
           Display: x11 server: X.Org 1.20.8 driver: nvidia resolution: 1680x1050~60Hz 
           OpenGL: renderer: GeForce GTX 1050 Ti/PCIe/SSE2 v: 4.6.0 NVIDIA 435.21 direct render: Yes 
Audio:     Device-1: Advanced Micro Devices [AMD/ATI] SBx00 Azalia vendor: Gigabyte driver: snd_hda_intel v: kernel 
           bus ID: 00:14.2 
           Device-2: NVIDIA GP107GL High Definition Audio vendor: eVga.com. driver: snd_hda_intel v: kernel bus ID: 01:00.1 
           Device-3: XMOS type: USB driver: hid-generic,snd-usb-audio,usbhid bus ID: 1-1:2 
           Sound Server: ALSA v: k5.3.0-62-generic 
Network:   Device-1: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Gigabyte driver: r8169 v: kernel 
           port: de00 bus ID: 03:00.0 
           IF: enp3s0 state: down mac: <filter> 
           Device-2: Realtek RTL8111/8168/8411 PCI Express Gigabit Ethernet vendor: Gigabyte driver: r8169 v: kernel 
           port: ce00 bus ID: 04:00.0 
           IF: enp4s0 state: up speed: 100 Mbps duplex: full mac: <filter> 
Drives:    Local Storage: total: 22.40 TiB used: 5.70 TiB (25.4%) 
           ID-1: /dev/sda vendor: Toshiba model: HDWE150 size: 4.55 TiB 
           ID-2: /dev/sdb vendor: Crucial model: M4-CT128M4SSD2 size: 119.24 GiB 
           ID-3: /dev/sdc vendor: HGST (Hitachi) model: HDS724040ALE640 size: 3.64 TiB 
           Partition: ID-1: / size: 32.45 GiB used: 24.12 GiB (74.3%) fs: ext4 dev: /dev/sdb3 
Sensors:   System Temperatures: cpu: 39.0 C mobo: N/A gpu: nvidia temp: 27 C 
           Fan Speeds (RPM): N/A gpu: nvidia fan: 30% 
Info:      Processes: 233 Uptime: 24m Memory: 15.64 GiB used: 1.25 GiB (8.0%) Init: systemd runlevel: 5 Compilers: gcc: 7.5.0 
           Shell: bash v: 4.4.20 inxi: 3.0.32 

Code: Select all

~$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: SB [HDA ATI SB], device 0: ALC889A Analog [ALC889A Analog]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: SB [HDA ATI SB], device 1: ALC889A Digital [ALC889A Digital]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 3: HDMI 0 [HDMI 0]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 7: HDMI 1 [HDMI 1]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 1: NVidia [HDA NVidia], device 8: HDMI 2 [HDMI 2]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 2: Audio [iFi (by AMR) HD USB Audio], device 0: USB Audio [USB Audio]
  Subdevices: 1/1
  Subdevice #0: subdevice #0
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 1 time in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

I have managed to get DeadDBeef to play files at the correct pitch/speed but only with the resampler. I did not have this selected in the DSP option. However this means that playback is not bit-perfect. In /proc/asound/card0/pcm0p/sub0/hw_params the sample rate is 48000 but my DAC (Ifi-Audio Zen DAC) is capable of sample rates up to PCM 192000.
Is there a way to increase the sample rate and/or bypass the resampler?
User avatar
MrEen
Level 23
Level 23
Posts: 18345
Joined: Mon Jun 12, 2017 8:39 pm

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by MrEen »

hag6 wrote: Tue Sep 28, 2021 5:37 am In /proc/asound/card0/pcm0p/sub0/hw_params the sample rate is 48000 but my DAC (Ifi-Audio Zen DAC) is capable of sample rates up to PCM 192000.
Is there a way to increase the sample rate and/or bypass the resampler?
In the terminal run xed admin:///etc/pulse/daemon.conf and when the file opens find this section:

Code: Select all

; default-sample-format = s16le
; default-sample-rate = 44100
; alternate-sample-rate = 48000
Anything you change there should include removing the semicolon at the front such as this:

Code: Select all

default-sample-format = s32le
default-sample-rate = 192000
alternate-sample-rate = 44100
Save your changes then run pulseaudio -k in the terminal to restart the sound daemon and test your sound.
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

Thank you so much MrEen for your help. Your suggestions have almost fixed my problem. By executing your instructions I am able to play PCM files with sample rates at 44.1, 96 & 192, which are confirmed on my DAC (LED colour) and in /proc/a sound/card2/pcm0p/sub0/hw_params.

Deadbeef is set to ALSA output plug-in/output device USB audio direct hardware device without any conversions

However. the files don't play perfectly every time. If I switch from a 44 file to a 192 file the playback is distorted. I need to restart Deadbeef a few times and it plays fine. Also. before I made these changes i was able to play .dff/.dsf files converted from DSD. Deadbeef is unable to play these now. I have only had success playing .dff/.dsf since upgrading deadbeef to v1.8.8.

I still have the Resampler set to “Autodect samplerate from output device”. I assume this will always be necessary.
Thank you again. I think I am almost set
User avatar
MrEen
Level 23
Level 23
Posts: 18345
Joined: Mon Jun 12, 2017 8:39 pm

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by MrEen »

Okay, when switching between rates and getting that issue, see if pulseaudio -k again helps. We're getting into advanced territory here where I probably won't be very useful. How did you install DeaDBeeF? Just wondering if a different version might be more suitable.
User avatar
Flemur
Level 20
Level 20
Posts: 10097
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by Flemur »

hag6 wrote: Wed Sep 29, 2021 12:23 pmIf I switch from a 44 file to a 192 file the playback is distorted. I need to restart Deadbeef a few times and it plays fine.
I've had better luck "playing everything" with audacious than with deadbeef. If you try it, get audacious v4.1 if possible.
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

MrEen wrote: Wed Sep 29, 2021 7:45 pm Okay, when switching between rates and getting that issue, see if pulseaudio -k again helps. We're getting into advanced territory here where I probably won't be very useful. How did you install DeaDBeeF? Just wondering if a different version might be more suitable.
Thanks for your continuing help. When I type pulseaudio -k into Terminal it doesn’t trigger any further info it jutt returns to the :~$. Is this correct.
I installed Deadbeef using the GDebi Package Installer downloaded from SourceForge.

Any thoughts most welcome. Thank you
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

Flemur wrote: Wed Sep 29, 2021 8:22 pm
hag6 wrote: Wed Sep 29, 2021 12:23 pmIf I switch from a 44 file to a 192 file the playback is distorted. I need to restart Deadbeef a few times and it plays fine.
I've had better luck "playing everything" with audacious than with deadbeef. If you try it, get audacious v4.1 if possible.
Thanks for your response. Audacious does play everything, perhaps I will use this instead of Deadbeef but I was led to believe that Deadbeef played bit-perfect but I don't think that is the case as it sends the signal/file via the Resampler.

I have Audacious v3.9 set to ALSA with the Output settings: PCM device HW:card=Audio,DEV_0=IFI USB Audio Direct hardware device without any conversions.
Mixer device: USB Audio Direct control device

After making changes to the PulseAudio daemon configuration, the sample rates of all PCM files play correctly as indicated in hw_params and by my DAC’s LED colour indicator. However DSD (converted to dff or dsf) files are very distorted. The are being played at the correct 352800 sample rate as indicated by hw_params. If I change the output plug-in to PulseAudio it plays the dff file but resamples down to 192. Can I amend the line in the Pulse config. from default-sample-format = 192000 to 352800

If I update Audacious to v4.1 is it advisable to uninstall the current version first.

Thank you so much for your advice.
User avatar
MrEen
Level 23
Level 23
Posts: 18345
Joined: Mon Jun 12, 2017 8:39 pm

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by MrEen »

hag6 wrote: Thu Sep 30, 2021 4:04 am Thanks for your continuing help. When I type pulseaudio -k into Terminal it doesn’t trigger any further info it just returns to the :~$. Is this correct.
I installed Deadbeef using the GDebi Package Installer downloaded from SourceForge.
Yes, it should just return to the prompt. Anything else happening would mean errors when restarting the sound daemon.

And I'm afraid my ability to help in this thread has reached it's end. I don't have any nice gear to make anything higher than 44100/48000 worth the effort, so I've not played with all the possibilities.
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

A massive thank you for your time and effort in trying to fix this issue.

I am sticking with audacious for now and I was able to play all files at the correct sample rates with alsa. However, some files did distort but I found that if I switched between PCM settings in Alsa Output Settings it seemed to clear itself and playback resorted back to normal.

I also changed default-sample-rate = 4100 and added a second alternate-sample-rate = 532800. This enabled dff files, converted from DSD, to play at this higher sample rate; confirmed in /proc/a sound/card2/pcm0p/sub0/hw_params.
All was fine for an hour or so. Now I am receiving the error message: ALSA error: snd_pcm_open failed: Device or resource busy.

I can only use Pulse which resamples all files down to 4100. Is there a fix?
User avatar
MrEen
Level 23
Level 23
Posts: 18345
Joined: Mon Jun 12, 2017 8:39 pm

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by MrEen »

When that happens check the output of sudo fuser -v /dev/snd/* to see if something like Speech-Dispatcher or another anomalous program has stolen your sound card. If you find nothing suspicious you could try sudo alsa force-reload and see if that works.
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

Thank you once again for offering these suggestions. Unfortunately, this didn't quite solve the problem.

Does this reveal anything?
sudo fuser -v /dev/snd/*
USER PID ACCESS COMMAND
/dev/snd/controlC0: h 1773 F.... pulseaudio
/dev/snd/controlC1: h 1773 F.... pulseaudio
/dev/snd/controlC2: h 1773 F.... pulseaudio


sudo alsa force-reload
Unloading ALSA sound driver modules: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-intel snd-intel-dspcfg snd-usb-audio snd-hda-codec snd-seq-midi snd-hda-core snd-usbmidi-lib snd-seq-midi-event snd-hwdep snd-rawmidi snd-pcm snd-seq snd-seq-device snd-timer (failed: modules still loaded: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-intel snd-intel-dspcfg snd-usb-audio snd-hda-codec snd-hda-core snd-usbmidi-lib snd-hwdep snd-rawmidi snd-pcm snd-seq-device snd-timer).
Loading ALSA sound driver modules: snd-hda-codec-hdmi snd-hda-codec-realtek snd-hda-codec-generic snd-hda-intel snd-intel-dspcfg snd-usb-audio snd-hda-codec snd-seq-midi snd-hda-core snd-usbmidi-lib snd-seq-midi-event snd-hwdep snd-rawmidi snd-pcm snd-seq snd-seq-device snd-timer


When I used sudo alsa force-reload it "released" the player from the "ALSA error: snd_pcm_open failed: Device or resource busy." However when I play 192 sample rate tracks they sound distorted. When I switch to Pulse while playing the track, the distortion goes and the track plays fine but resampled down to 44100. Then I switch back to Alsa and the error message returns. Then, if I select a true 44100 track this track plays fine. Unfortunately, when I select a 192 sample rate track it plays distorted.

The only way to remove the error message and distortion from 192 tracks is to switch between PCM devices several times while the track plays (finally selecting ALSA with the Output settings: PCM device HW:card=Audio,DEV_0=IFI USB Audio Direct hardware device without any conversions) and then it will play correctly

I tried to update Audacious to the latest release, 4.1, but the PPA failed to load due to keyserver issues. Perhaps my OS is too old for this version.(Kernel: 5.3.0-62-generic x86_64 bits: 64 compiler: gcc v: 7.5.0 Desktop: Cinnamon 4.4.8 Distro: Linux Mint 19.3 Tricia base: Ubuntu 18.04 bionic).
User avatar
MrEen
Level 23
Level 23
Posts: 18345
Joined: Mon Jun 12, 2017 8:39 pm

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by MrEen »

Your kernel could be part of the problem. I'm pretty sure 5.3 is well beyond the support stage.

Your fuser output was normal.

I've seen the Device or resource busy error thousands of times, with over 50% making no sense to me. Maybe things just need a reboot at that stage, which is what I was trying to avoid recommending with the last post. Sometimes sound does get stuck and needs a reboot to fix itself.

One other tip that might be useful is to occasionally delete the files in /home/YourUserName/.config/pulse then run pulseaudio -k in the terminal. Sometimes the tables in there get corrupted causing issues that are otherwise hard to solve. If your software has added any folder in there, just leave them alone. Only delete the cookie, .tdb and default-somethinghere files.
hag6
Level 2
Level 2
Posts: 90
Joined: Mon Nov 04, 2019 9:32 am

Re: Issues with Alsa and music players Deadbeef & Audacious

Post by hag6 »

When I update the kernel I can’t connect to the internet. So I have stayed on the older version. I haven’t found a fix for this issue.

I did try to update to the latest kernel (5.14.9) to see if the playback issues would be resolved but unfortunately not. All files play fine for a while and then the same problems reoccur. It’s really frustrating. The only solution is to use either Audacious or Deadbeef with Pulse which clearly resamples higher sample rate files down to 41000. Thanks for your help
Locked

Return to “Sound”