I'm using my laptop a.o. as an audio player, outputting to various external USB DACs (digital-to analog converters) in a bit-perfect way. I'm using mpd as music player (service enabled at boot in user mode), with mpd directed to do its output via alsa directly to the USB DACs. My mpd client of choice is Cantata. There is a number of USB DACs available, a Chord Hugo 2 (FPGA type), an AudioQuest DragonFly Red (PIC32MX receiver), and a miniDSP USB Streamer (XMOS receiver).
I am playing PCM only, coming from FLAC files (all flavors from 16 bits / 44.1 kHz to 24/192) and DSD files (DSF, from DSD64 to DSD256). Since neither Linux OS is able to handle native DSD, mpd is being directed to output such audio files as DoP. All my music is lossless, no mp3 or similar.
I am encountering reproducible issues with such an installation on Manjaro (fully updated, Stable branch). I do also run openSUSE Tumbleweed in multiboot on this laptop, same chain of mpd/alsa/usb. Tumbleweed doesn't give me any issue!
I have a playlist made up of a succession of albums, each album consisting of a number of tracks. All tracks within an album have the same bit depth and samplerate. I have Cantata ask mpd to play this playlist. The issue on Manjaro (ONLY, not on Tumbleweed) is: When advancing from the last track of album N to the first track of album N+1, mpd gets caught in an alsa error and gets paused, if the samplerates of album N and album N+1 are different. The mdp.log output from start to beyond that error is:
Jun 20 03:22 : exception: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
Jun 20 03:22 : avahi: Service 'Music Player @ mylappy' successfully established.
Jun 20 03:24 : exception: Unsupported URI scheme
Jun 20 03:24 : exception: Failed to open '/home/myself/.config/mpd/playlists/[Radio Streams].m3u': No such file or directory
Jun 20 03:24 : exception: No such playlist
Jun 20 03:24 : exception: OutputThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
Jun 20 03:39 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 1/02 - Italian Concerto in F major, BWV 971 - 1. Allegro - 2. Andante - 3. Finale. Presto.flac"
Jun 20 04:00 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 1/03 - Partita No. 1 in B flat major, BWV 825 - 1. Prelude - 2. Allemande - 3. Courante - 4. Sarabande - 5. Minuetto I - 6. Minuetto II - 7. Gigue.flac"
Jun 20 04:05 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 1/04 - Choral 'Jesus bleibet meine Freude' (Cantata No. 147 'Herz und Mund und Tat und Leben', BWV 147).flac"
Jun 20 04:18 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 1/05 - Toccata & Fugue in D minor, BWV 565.flac"
Jun 20 04:27 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/01 - Two-Part Invention No. 8 in F major, BWV 779.flac"
Jun 20 04:29 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/02 - Prelude No. 2 in C minor, BWV 847 (The Well-Tempered Clavier, Book I).flac"
Jun 20 04:32 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/03 - Prelude No. 12 in F minor, BWV 881 (The Well-Tempered Clavier, Book II).flac"
Jun 20 04:50 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/04 - Harpsichord Concerto No. 1 in D minor, BWV 1052 - 1. Allegro - 2. Adagio - 3. Allegro.flac"
Jun 20 04:55 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/05 - Aria (Orchestral Suite No. 3 in D major, BWV 1068).flac"
Jun 20 05:03 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/06 - Choral No. 1 'Wachet auf, ruft uns die Stimme', BWV 645 (Schübler's Book).flac"
Jun 20 05:07 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/07 - Sinfonia (Cantata No. 29 'Wir danken dir, Gott, wir danken dir', BWV 29).flac"
ALSA lib pcm_hw.c:1826:(_snd_pcm_hw_open) Invalid value for card
Jun 20 05:07 : exception: Failed to open "Optical USB Streamer - USB Audio" (alsa)
Jun 20 05:07 : exception: nested: Failed to open ALSA device "hw:CARD=USBStreamer,DEV=0": No such device
Jun 20 05:07 : exception: Failed to open "Optical USB Streamer - USB Audio" (alsa)
Jun 20 05:07 : exception: nested: Failed to open ALSA device "hw:CARD=USBStreamer,DEV=0": No such device
Jun 20 05:07 : player: problems opening audio device while playing "WR/Jarrett, Keith/Setting Standards - New York Sessions [CD & HiRes]/Album 1 - Standards Vol. 1/2015 HiRes HRA/01 Meaning of the Blues.flac"
Jun 20 07:29 : player: played "WR/Jarrett, Keith/Setting Standards - New York Sessions [CD & HiRes]/Album 1 - Standards Vol. 1/2015 HiRes HRA/01 Meaning of the Blues.flac"
Jun 20 07:37 : player: played "WR/Jarrett, Keith/Setting Standards - New York Sessions [CD & HiRes]/Album 1 - Standards Vol. 1/2015 HiRes HRA/02 All the Things You Are.flac"
The Loussier album is 16/44.1, the Jarrett 24/192. The important piece is:
Jun 20 05:07 : player: played "LL/Loussier, Jacques/Play Bach aux Champs-Élysées [1995 CD]/Disc 2/07 - Sinfonia (Cantata No. 29 'Wir danken dir, Gott, wir danken dir', BWV 29).flac"
ALSA lib pcm_hw.c:1826:(_snd_pcm_hw_open) Invalid value for card
Jun 20 05:07 : exception: Failed to open "Optical USB Streamer - USB Audio" (alsa)
Jun 20 05:07 : exception: nested: Failed to open ALSA device "hw:CARD=USBStreamer,DEV=0": No such device
Jun 20 05:07 : exception: Failed to open "Optical USB Streamer - USB Audio" (alsa)
Jun 20 05:07 : exception: nested: Failed to open ALSA device "hw:CARD=USBStreamer,DEV=0": No such device
Jun 20 05:07 : player: problems opening audio device while playing "WR/Jarrett, Keith/Setting Standards - New York Sessions [CD & HiRes]/Album 1 - Standards Vol. 1/2015 HiRes HRA/01 Meaning of the Blues.flac"
Jun 20 07:29 : player: played "WR/Jarrett, Keith/Setting Standards - New York Sessions [CD & HiRes]/Album 1 - Standards Vol. 1/2015 HiRes HRA/01 Meaning of the Blues.flac"
It seems mpd needs to close and re-open the USB device when a samplerate change occurs. When the switch from one album to the next does not involve a samplerate change, mpd just keeps on playing fine. (Remark: I didn't check yet whether the same issue issue occurs at a bit depth change.)
At such a point in time on Manjaro only, mpd gets paused, and the USB DAC is left in a state where it shows the samplerate of the last track from album N. Hitting Play on Cantata lets mpd continue correctly at the first track of album N+1, as can be seen from the logs.
Remark: These logs were done in log-level default on mpd. log-level verbose could be shown, too, but it didn't reveal anything more to me.
My mpd user configuration is IDENTICAL on both Manjaro and Tumbleweed:
############################################################################
### This is the mpd configuration in a per-user setup.
### Local configuration stored in ~/.config/mpd (all files),
### where ~ is /home/myself
###
### Autostart of mpd with systemd, running the user unit (NO sudo priv's!):
### systemctl enable --user mpd.service
###
### Devices: Chord Hugo 2, AudioQuest DragonFly Red,
### miniDSP USB Streamer B, Internal Sound Cards,
### to be enabled/disabled individually/simultaneously from mpc, cantata,
### or via editing their respective blocks here.
### Laptop HP 8570w
###
### Hugo 2 DSD only via DoP, Linux quirks.c w/o native DSD patch for Chord
###
### Resampling is applied by mpd only to DragonFly,
### but doesn't adhere to the 44.1/48k ladders yet (feature request to mpd)
###
### mpd can't decode HDCD
###
############################################################################
## start processing `01_output-audio-alsa.conf'
#### Chord Hugo 2
audio_output {
type "alsa"
name "Hugo2 - USB Audio"
## device "hw:2,0"
device "hw:CARD=Hugo2,DEV=0"
auto_resample "no"
auto_format "no"
auto_channels "no"
dop "yes"
replay_gain_handler "none"
mixer_type "none"
}
#### end of Chord Hugo 2
#### miniDSP USB Streamer B (optical input to Hugo 2)
audio_output {
type "alsa"
name "Optical USB Streamer - USB Audio"
## device "hw:2,0"
device "hw:CARD=USBStreamer,DEV=0"
auto_resample "no"
auto_format "no"
auto_channels "no"
dop "yes"
replay_gain_handler "none"
mixer_type "none"
}
#### end of miniDSP USB Streamer B
#### AudioQuest DragonFly Red
audio_output {
type "alsa"
name "Dragonfly Red - USB Audio"
## device "hw:2,0"
device "hw:CARD=v10,DEV=0"
auto_resample "no"
auto_format "no"
auto_channels "no"
dop "no"
replay_gain_handler "none"
mixer_type "none"
}
#### end of AudioQuest DragonFly Red
#### Internal Sound Card - HP 8570w
audio_output {
type "alsa"
name "Internal Sound Card - HP 8570w"
## device "hw:0,0"
device "hw:CARD=PCH,DEV=0"
auto_resample "no"
auto_format "no"
auto_channels "no"
dop "no"
replay_gain_handler "none"
mixer_type "none"
}
#### end of Internal Sound Card - HP 8570w
#### general settings for all output devices
resampler {
plugin "libsamplerate"
type "0"
}
replaygain "off"
## done processing
## start processing `02_paths.conf'
music_directory "~/AVs/I/Music"
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/mpd.log"
playlist_directory "~/.config/mpd/playlists"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
sticker_file "~/.config/mpd/sticker.sql"
save_absolute_paths_in_playlists "no"
## done processing
## start processing `03_general.conf'
filesystem_charset "UTF-8"
id3v1_encoding "UTF-8"
log_level "default"
## log_level "verbose"
auto_update "yes"
auto_update_depth "4096"
## done processing
## start processing `04_client-limits.conf'
connection_timeout "60"
max_connections "10"
max_playlist_length "16384"
max_command_list_size "2048"
max_output_buffer_size "8192"
## done processing
## start processing `05_network.conf'
bind_to_address "0.0.0.0"
## done processing
## start processing `06_zeroconf.conf'
zeroconf_enabled "True"
## done processing
############################################################################
### end of mpd configuration file
############################################################################
I did also check the relevant package versions on the two distros:
alsa is identical: 1.1.9
mpd is different: 0.21.10 on Manjaro, 0.21.2 on Tumbleweed
Cantata is identical: 2.3.3
Manjaro has alsa-firmware installed which is a dependency of manjaro-alsa. Tumbleweed doesn't have alsa-firmware installed. alsa-firmware contains binary drivers for various third-party hardware. I did not try to uninstall alsa-firmware on Manjaro, since it would break manjaro-alsa which is described as an alsa metapackage. So I have no idea whether the observed issue is due to alsa-firmware and/or manjaro-alsa.
Regarding the mpd version difference: Of course, Manjaro's mpd could have introduced a regression as compared to Tumbleweed's mpd - I wouldn't know. I think to remember that Manjaro gave me the same problem more than a year ago, with some prior version of mpd.
Regarding the two alsa configurations: I did not change anything in any alsa config against what the two distros installed on their own, neither in the global /etc/asound.config, nor in the per-user ~/.asoundrc. In fact, there is no ~/.asoundrc on either distro.
My questions to the community are:
- Did anybody encounter the same or a similar issue?
- What more information could I provide for debugging?
- What else could I do? (e.g. uninstall alsa-firmware on Manjaro and break manjaro-alsa?)
- What could cause the different behaviors of Manjaro and Tumbleweed? Could I get the same lower mpd version number in a Manjaro package and install it?
The reason for me to start asking for help on this forum is obvious: Tumbleweed doesn't give me any issues with mpd/alsa/usb. So I don't feel like asking on the mpd forum or even the mpd bugzilla yet.