Thursday, January 25, 2018

RaspBerry PI - The Audio Engine - Part 6 - DSD Native

Part 6 of the series is dedicated to show how DSD-native playback can be achieved
on a RPI running piCorePlayer.  

DSD is quite a fashioned feature since a couple of years. It's a niche format though. However. There's a small community considering it a must-have-feature for audiophile audio playback systems. 

This exercise will show you how to get DSD working in your LMS/squeezelite environment.  

NOTE: This guide requires piCorePlayer 3.5

Basically there are two major formats. DSD-native and DSD-DOP. 

DSD-native is a 1bit audio-data format at a samplerate starting at 2.8224Mhz (DSD-64). 
DSD goes up to DSD-1024. 512 and 1024 are more of theoretical nature. Even 256
can IMO be considered overkill. But at least you'll find this or that material in 256.
filesizes are insane. It quickly goes up to one GByte and more per track !!
DSD-DOP (DOP=Dsd Over PCM) basically is DSD-native packaged into PCM/WAV format. 
The PCM-"container" gets filled with 1-bit DSD data. 
Trying to play this back as PCM will generate pretty nasty and potentially dangerous  0db noise!

DSD-DOP can also get packaged into a flac file.  For the flac codec DOP looks like PCM.

The entire digital chain treats DOP data as PCM. Only the DAC needs to figure out how to make a DSD stream from the incoming DOP stream.

DSD-native requires just half the bandwidth compared to DSD-DOP. 
E.g. DSD-DOP-128 requires a PCM rate of 352.8kHz. DSD-native-128 requires a bandwidth of just 176.4kHz. 

If you want to run DSD-native, you need DSD-native support throughout your chain.

What both modes - DOP and native - have in common: 
There can't be any digital volume control in the path! 
You'd simply corrupt the DSD data. 
It requires a volume control after the DAC chip - in the analog domain - to be able to apply different levels to DSD.

Which DACs support DSD ??  

All RPI HAT DACs are connected via I2S. I2S works with PCM only. 
That's why HAT-DACs that support DSD, can support DSD-DOP only.
DOP is
treated like PCM over I2S. 
Usually an on-DAC MCU or the DAC chip takes care of the  DOP to DSD conversion.
You might better call it extraction.

DSD-DOP is limited to DSD-DOP-128 since this requires the maximum RPI I2S 
bandwidth of 352.8kHz (44.1x) already.

I havn't seen any HAT DAC for the PI yet that runs true-DSD (after DOP conversion).  
I had the Audiophonics I-Sabre ES9028Q2M HAT in my hands, which supports DOP. 
This DAC offers on-DAC digital volume control. It can be accessed via the DAC driver (alsamixer). 
It seems, after reading this or that, that the DSD data inside the DOP stream gets 
converted back to PCM on e.g. Sabre DACs.  That would explain why digital volume 
control still works on the Audiophonics DAC. We just can't talk about true-DSD anymore.

Now. How do we go on to get DSD-native going !?!?

If we want to run DSD-native and true-DSD we won't get around finding a matching DSD-native capable true-DSD USB-DAC.

Guess what. I found one. The iFi Nano iOne.
An IMO very nice device for this exercise. It'll support DSD-native and also delivers true-DSD. 
There's no analog volume control on the DAC and the entire digital chain doesn't support - for obvious reasons - digital volume control on DSD material

(iFi generously lent me an iOne for doing integration testing of my kernels, OS and squeezelite under Moode. Right now I'm also doing the DSD-native testing 
for piCorePlayer 3.5) 

Ok. Ok. Let's stop the chatting. Get something done.


The HW setup will be based on a PI3 again. As I said. I'm using the iFi Nano iOne as DAC for this exercise.
And I also use the iFi USB isolator "iDefender3.0" to be able to power the DAC externally. The iDefender also acts as filter and ground isolator to get the noisy USB port isolated. 
The iOne DAC is a buspowered DAC. I actually prefer to avoid loading the PI power rails with additional equipment. By using the iDefender I can get around this and can
power the DAC with an external 5V supply.

You can see the setup in above picture.

As mentioned  the OS of choice is piCorePlayer. 

However. It's the recently launched version 3.5 I'm working with.   

piCorePlayer >= 3.5 is a must! 

Why is that?

First. It comes with a DSD-native capable squeezelite binary.

And 2nd. For smooth DSD operation a >4.14.x Linux kernel is a must! 
Older kernels exhibit nasty 0db noise/thumps when switching DSD tracks. 
Such a flaw might get your speakers smoked. Be careful!!! 
Quite some Audio distros out there are still on kernel 4.9.x!

And 3rd. There've been quite some performance improvements introduced 
over time. That'll further help to avoid XRUNS on the demanding DSD streams 
and related processing.   

To begin with I applied most of the OS measures as discussed earlier in the series.


First we need to enable the DSD-native capable binary.

Then we need to setup the USB DAC

Then we disable the PI internal audio under "Audio card control".

Finally we configure squeezelite

As you might have noticed I decreased the output buffersize. The DSD files are that big that 
full-file RAM buffering is impossible to accomplish.

I also increased the Alsa buffer to 160ms. As mentioned earlier USB DACs work better with bigger buffers in comparison to e.g. I2S HAT DACs.

And then the crucial parameter for DSD-native comes last. The stream format that's required for your DAC. There are several DSD formatting options offered by squeezelite:

DOP (default if nothing is specified), u8, u16le, u16be, u32le or u32be

The iFi DAC works with "u32be". (Most modern DACs should run this) 

I hear you !?!? How do I figure out what to use for my DACs !?!? Start with "u32be" and if the manufacturer hasn't communicated anything around this, run the "trial and error" method and try each of them.
And also have a look at your DAC manual, to make sure beforehand if your DAC supports DSD-native at all. If your DAC supports just DOP, you can also use the DSD binary. You'd just give a plain "-D" as option.

And that's pretty much it.

One the RPI side - at least.


How about DSD test material? Do you own DSD tracks?

You'll find plenty of test tracks over here  for download.


Let's have a look at the LMS side. 

Make sure you have the latest LMS 7.9.x - preferably "nightly" version installed!

First we need to install the 3rd-party DSD plugin.

Then we make sure that the file formats are properly set.

and finally we check if our client has it activated.

Finally. You're good to go.

You'll notice in above screenshot that the volume control is off.  It's done by the system automatically nowadays!
As outlined earlier. There's no way to run digital volume control if the DAC and/or the DAC driver is not supporting it.

And finally the verification. By having a look from a terminal what Alsa is doing during playback. 
As you can see in above screenshot,  I'm running a DSD-256-native stream. 

The result below is exactly showing what's been expected:

The "format" is  DSD_U32_BE and the "rate" is 352800.


Ooookay. I think we're all set.
I hope you can make use of this article and again thx to iFi and of course the piCorePlayer team for making this exercise possible.



  1. Good work! I am looking for similar function replacement for Roonlab trial expire.

  2. Hello, I have tried everything above. I don't seem to get DSD native to my Yamaha CD-S3000 connected via USB. Yamaha only accepts native DSD and in Windows it requires an ASIO driver to work.