Skip to content

Latest commit

 

History

History
261 lines (170 loc) · 9.22 KB

README.md

File metadata and controls

261 lines (170 loc) · 9.22 KB

Linux native DSD playback support

[21-feb-15]

Update to kernel 3.18.7 for Fedora 21. Support added for Denon DA300-USB (per kernel bugzilla #93261)

[31-jan-15]

SRPMs and patches for Fedora 21.

[28-nov-14]

Support for Denon/Marantz HiFi devices with USB DACs added.
Kernel updated and added kernel patches.

[24-nov-14]

DSD sampleformat for 32-bit samples changed to DSD_U32_BE.
ALSA, MPD and kernel packages and patches updated.
New kernel 3.17.4

[19-nov-14]

news: native DSD support now working for Marantz/Denon DACs.

Although not XMOS based, recent Denon en Marantz CD/SACD players and DACs also support native DSD playback using a 32-bit sample format. The following device will be supported shortly:

  • Marantz SA-14S1
  • Marantz HD-DAC1

Stay tuned.

Native DSD support for XMOS based devices

XMOS based USB DACs and converters can support native DSD playback using a 32-bit sample format. DACs that support this feature expose it using a Alternate Setting on the USB interface.

On Windows systems this feature can be used with a ASIO 2.1/2.2 driver from the DAC manufacturer.

I have added a new DSD sample format to ALSA and the Linux kernel (DSD_U32_LE) to support it on Linux and added the needed quirks to support it for a few XMOS based USB DACs/boards.

Currently native DSD playback on Linux is supported for the following XMOS based DACs/USB converters:

  • iFi Audio micro iDSD [max DSD512]
  • iFi Audio nano iDSD [max DSD256, with latest 4.04 firmware]
  • DIYINHK USB to I2S/DSD converter [max DSD128]
  • ..more to follow

ALSA support status:

  • New DSD sample format accepted, code resides in ALSA development git
  • Will be generally available with the next ALSA release (1.0.29)

Kernel support status:

  • Kernel 3.18rc1 contains the needed new sample format support
  • Kernel 3.18rc1 supports the iFi Audio and DIYINKHK devices

Linux Playback support:

Check if you have a supported device

Currently devices with USB ID 20b1:3008 and USB ID 20b1:2009 are supported. This are devices from iFi Audio/AMR and DIYINHK. If you think you have a (XMOS based) DAC device or converter that should support native DSD playback please contact me.

To check if your device is supported, or at least XMOS based(1), use the following command:

lsusb -d 20b1:

For the iFi Audio nano and micro iDSD it reports: Bus 003 Device 004: ID 20b1:3008 XMOS Ltd (please note: Bus and Device numbers may vary).

(1) Some manufacturers may use the XMOS chip with their own vendor id instead of XMOS.

HOWTO

There are three ways to get enable native DSD playback on your Linux system:

  1. Use pre-compiled binaries
  2. Build the RPMs yourself
  3. Patch and build from source

1. Use pre-compiled binaries

Pre-compiled binaries are provided for Fedora 20 x86_64. Before installing them, make sure your Fedora installation is fully up-to-date.

Prerequisites:

  • rpmfusion repo added and enabled (rpmfusion-free should be sufficient)

Steps:

  • clone this repo
  • Install the RPMS from the RPMS directory

Start with the kernel:

sudo yum localinstall kernel-3.17.4-200.jk6.fc20.x86_64.rpm

If needed, also install the kernel-headers and kernel-devel packages.

Replace ALSA lib, the current ALSA lib needs to be overwritten due to the many dependencies.

sudo rpm -ivh alsa-lib-1.0.27.2-2.fc20.x86_64.rpm --force

If needed, install the alsa-devel package as well.

Install/update MPD:

sudo yum localinstall mpd-0.18.16-2.fc20.x86_64.rpm

With the rpmfusion repo enabled any missing library will be installed as dependency.

As a final installation step, reboot the machine. After the reboot make sure you are running the new kernel: uname -r should report 3.17.4-200.jk1.fc20.x86_64.

Now configure mpd (/etc/mpd.conf) to your liking and add the statements with "dsd_native" to the audio section, e.g.:

audio_output {
  type "alsa"
  name "iFi Audio micro iDSD"
  device "hw:1,0"
  # Enable native DSD playback
  dsd_native "yes"
  # Select 32-bit DSD_U32_BE output format
  dsd_native_type "2"
}

Nb if you have DSD over PCM (DoP) enabled with "dsd_usb" "yes", disable it with "dsd_usb" "no".

Verifify that is works

To verify that native DSD playback actually works, play back a DSD file using either MPD or the playdsd.py script and check the 'hw_params' file of your ALSA audio device.

Example for a DSD64 file:

cat /proc/asound/Audio/pcm0p/sub0/hw_params
access: MMAP_INTERLEAVED
format: DSD_U32_BE
subformat: STD
channels: 2
rate: 88200 (88200/1)
period_size: 11025
buffer_size: 44100

Notice the DSD_U32_BE sample format and rate of 88200.

2. Build the RPMs yourself

These instructions are tested on Fedora 20 x86_64.

General prerequisites:

Prerequisites for building MPD:

  • rpmfusion repo added and enabled (rpmfusion-free should be sufficient)

Prepare:

  • clone this repo

Build the kernel:

  • Download the required kernel source RPM from [koji] (http://koji.fedoraproject.org/koji/packageinfo?packageID=8)

  • Make sure the needed dependencies are installed:

    sudo yum-builddep kernel-<version>.src.rpm
    yum install pesign

  • Install it (as normal user).

    rpm -ivh <kernel-source-rpm>

  • Copy the needed patches from this repo to the SOURCES directory

    cp SRPMS/patches/* ~/rpmbuild/SOURCES

  • Replace the SPEC file (2):

    cp SPECS/kernel.spec ~/rpmbuild/SPECS

(2) If you use another kernel then 3.17.4-200, its SPEC file needs to be adjusted to include the needed patches

  • Build the kernel, e.g.:

    cd ~/rpmbuild/SPECS
    rpmbuild -bb --without debug --without perf --without debuginfo --target=`uname -m` kernel.spec

Build ALSA lib:

  • Make sure the needed dependencies are installed:

    sudo yum-builddep alsa-lib-1.0.27.2-2.fc20.src.rpm

  • Install it (as normal user):

    sudo rpm -ivh alsa-lib-1.0.27.2-2.fc20.src.rpm

  • Build it (as normal user):

    cd ~/rpmbuild/SPECS
    rpmbuild -bb --target=`uname -m` alsa-lib.spec

Build MPD:

  • Make sure the needed dependencies are installed:

    sudo yum-builddep mpd-0.18.16-2.fc20.src.rpm

  • Install it (as normal user):

    sudo rpm -ivh mpd-0.18.16-2.fc20.src.rpm

  • Build it:

    cd ~/rpmbuild/SPECS
    rpmbuild -bb --target=`uname -m` mpd.spec

Install the created RPMs using HOWTO step 1 above.

3. Patch and build from source

General instructions for compiling everything yourself. The needed patches are in SRPMS/patches.

kernel

Download and prepare the kernel source for your distribution. Enter the kernel source directory. Check if the patches apply cleanly:
patch -p1 < /path/to/SRPM/patches/kernel/alsa-add-dsd-u32-le-v5.patch --dry-run
patch -p1 < /path/to/SRPM/patches/kernel/0001-add-native-DSD-support-for-XMOS-based-DACs.patch --dry-run
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-marantz-ctl-msg-quirk-v2.patch --dry-run
patch -p1 < /path/to/SRPM/patches/kernel/alsa-add-dsd-be-formats.patch --dry-run
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-switch-xmos-dsd-quirk-to-be.patch --dry-run
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-add-marantz-dsd-quirk.patch --dry-run
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-marantz-select-mode-quirk-v5.patch --dry-run

If the patches apply cleanly, apply them.
patch -p1 < /path/to/SRPM/patches/kernel/alsa-add-dsd-u32-le-v5.patch
patch -p1 < /path/to/SRPM/patches/kernel0001-add-native-DSD-support-for-XMOS-based-DACs.patch
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-marantz-ctl-msg-quirk-v2.patch
patch -p1 < /path/to/SRPM/patches/kernel/alsa-add-dsd-be-formats.patch
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-switch-xmos-dsd-quirk-to-be.patch
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-add-marantz-dsd-quirk.patch
patch -p1 < /path/to/SRPM/patches/kernel/alsa-usb-marantz-select-mode-quirk-v5.patch

Compile and install the kernel as per instructions for your Linux distribution.

ALSA lib

The provided ALSA patches are for ALSA lib version 1.0.27.2.

Download the ALSA lib 1.0.27.2 sources from ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.27.2.tar.bz2

Unpack and enter the alsa-lib-1.0.27.2 directory. Apply the patches:

patch -p1 < ~/path/to/SRPMS/patches/alsa-lib/0001-pcm-Fix-DSD-formats-userland-usability.patch --dry-run
patch -p1 < ~/path/to/SRPMS/patches/alsa-lib/0001-pcm-Add-missing-signed-and-endianess-definitions-for.patch --dry-run
patch -p1 < ~/path/to/SRPMS/patches/alsa-lib/0001-pcm-2nd-round-of-pcm_misc-DSD-fixes.patch --dry-run
patch -p1 < ~/path/to/SRPMS/patches/alsa-lib/alsa-lib-add-dsd-u32-le-v3.patch
patch -p1 < ~/path/to/SRPMS/patches/alsa-lib/alsa-lib-add-dsd-be-formats.patch

Compile and install alsa-lib.

MPD

Use [mpd-dsd-018] (https://github.com/lintweaker/mpd-dsd-018). Configure mpd to use dsd_native as mentioned above.