You are not logged in.
Posting some details of a solution I came up with in the hopes it might help someone else out there. There's not much info available about using DACs on Linux from what I could see.
I recently purchased a Schiit Bifrost 2 DAC, set it up and everything worked right out of the box without much configuration. It sounded great, but still, I couldn't get rid of a nagging doubt that I wasn't actually using the DAC hardware to decode PCM streams. To put it another way, how could I be sure there wasn't some sort of resampling of a 24bit/192kHz FLAC file by the software somewhere in the system? My research online pointed to needing to make sure I could use the card in 'exclusive mode' to ensure I was getting hardware decoding. (Spoiler alert: I was right to have doubts.)
Unfortunately the DAC I'm using doesn't have a display that shows the bitrate of what it's currently encoding. I did a bit of research and it turns out that the Bifrost does make a soft click when the bitrate of the PCM stream changes. (There are physical switches inside the device that open or close when changing bitrate.) I hadn't heard any clicking when playing high bitrate FLAC files under Linux, so I plugged it into a Windows box, configured MPV-HC to output in exclusive mode, and, lo and behold, I heard clicking.
Okay, so how to get this exclusive mode working under Linux, preferably with mpv, my player software of choice? Turns out that mpv does have a switch to enable exclusive mode, '--audio-exclusive', but it needs to be used with the correct hardware device specified with the '--audio-device' switch. You can get a list of available devices by running mpv with the '--audio-device=help' grepped against 'iec985':
$ mpv --audio-device=help | grep iec958
'pulse/alsa_output.usb-Schiit_Audio_Schiit_Bifrost_2_Unison_USB-00.iec958-stereo' (Schiit Bifrost 2 Unison USB Digital Stereo (IEC958))
'alsa/iec958:CARD=USB,DEV=0' (Schiit Bifrost 2 Unison USB, USB Audio/IEC958 (S/PDIF) Digital Audio Output)
'alsa/iec958:CARD=PCH,DEV=0' (HDA Intel PCH, ALC1150 Digital/IEC958 (S/PDIF) Digital Audio Output)In the output above, I've got the Bifrost connected via USB, so we'll want to use the second device in the list: 'alsa/iec958:CARD=USB,DEV=0'. The third item in the list is the onboard mobo sound card, which we definitely don't want to use in this case. If you're connecting to a DAC via S/PDIF/TOSLINK from your motherboard, then you will want to use the alsa/iec958 device on your motherboard. (I've tested with a second desktop that I have connected to the Bifrost via TOSLINK and it worked.)
Now that we know the device name, we can use mpv in exclusive mode via:
mpv --audio-exclusive --audio-device='alsa/iec958:CARD=USB,DEV=0' FILENAMEUsing those mpv switches, I hear clicks from the Bifrost. Success! As I mentioned above, this method will work when connecting to a DAC over both USB and TOSLINK.
If you're not a fan of mpv, you can also use 'speaker-test' to send raw PCM data to the DAC:
speaker-test -D iec958 -r 44100 -F S16_LE -c 2
speaker-test -D iec958 -r 192000 -F S32_LE -c 2Finally some useful links:
[SOLVED] Bit Resolution in /etc/pulse/daemon.conf ignored by alsa sink
This post has some short C code that can be compiled to probe your DAC to show what bitrates and formats are supported on the device.
Linux and USB Audio Class 2 (UAC2) external DACs. Can it be enabled?
This post is where I found info on using speaker-test for testing purposes.
Happy computing!
Last edited by chicovstheworld (2022-11-18 06:08:09)
Offline