piCorePlayer streaming WavPack-compressed DSD128 (1-bit, 5.6MHz) to TEAC UD-501 from recent nightly version of Logitech Media Server 7.9.1. |
First let me discuss what the aim is here. The idea is to allow the LMS system to incorporate DSD into the library and stream DSD files compressed as WavPack to connected devices - ideally as DSD, otherwise transcoded to PCM. Remember that because WavPack can handle both PCM and DSD, it might get confusing if in your library there are both PCM and DSD music encoded in the WavPack format. Therefore in my library I have made sure that all my PCM music is encoded in FLAC, leaving WavPack to handle just DSD material. If you're good with doing this, then proceed :-).
Without further ado, let's get to the steps...
A. Higher level settings...
1. Although not necessary when it comes to WavPack, remember it's OK to turn on the DSDplayer plugin in LMS. Since we're activating DSD streaming, might as well allow LMS to handle uncompressed DSD including transcoding to PCM for devices that are not DoP compliant.In the image above, notice DSDPlayer is checked. And also notice I still have BruteFIR Room Correction turned on. These instructions will not mess around with FLAC streaming so my usual room correction DSP is unaffected by this. Room correction DSP will not affect WV or DSD playback even when transcoding through PCM.
2. LMS allows DoP DSD streaming and the device has to let LMS know it's capable. As in the image above, I'm running a Raspberry Pi 3 with "Touch" display (as described here). I'm running the latest version piCorePlayer 3.22. Here are the squeezelite settings with the TEAC UD-501 attached via USB to the Pi 3 "Touch":
Note that I put in a 250ms delay switching between PCM and DSD. I don't know if this is the same with other devices, but I needed to put a value here otherwise the DAC doesn't switch into DSD mode properly. Also for my ALSA settings, I increased the buffer size to 120ms (from 80) just for that extra leeway. Pretty much a formality, but in the "Max sample rate", I listed all the sample rates the TEAC DAC is capable of:
44100,48000,88200,96000,176400,192000,352800,384000Of course the Raspberry Pi 3 / piCorePlayer config.txt had the CRAAP underclock/undervolt settings applied for "better" sound :-).
B. Logitech Media Server Configuration
3. Now it's time to get our hands dirty into the Linux box and change some LMS settings (I'm currently running a recent nightly build - 7.9.1 - 1510723637_amd64 specifically). First, let's get the binary for WavPack 5 (currently the newest is 5.1.0). Grab pre-built binaries for your architecture. So for example I'm using Ubuntu amd64, so I can grab the required libwavpack1_5.1.0-2_amd64.deb here and grab wavpack_5.1.0-2_amd64.deb here and install with:sudo dpkg -i libwavpack1_5.1.0-2_amd64.deb
sudo dpkg -i wavpack_5.1.0-2_amd64.deb
The installation should go without a hitch and you will now have WavPack 5 on the system now. Note that you might not need to do this if you have a new version of Ubuntu with WavPack 5 pre-installed already.
4.With the binaries installed, double check it's the right version:
wvunpack --versionIt should say you're on version 5.1.0. Now we replace wvunpack in LMS's binaries directory with the new one. You can find out where the new binary is with:
which wvunpack
It tells me that it's installed in "/usr/bin/wunpack". So I copy that to /usr/share/squeezeboxserver/Bin/x86_64-linux/ which is where LMS sticks all the binaries it calls upon to perform transcoding and conversions.
sudo cp /usr/bin/wvunpack /usr/share/squeezeboxserver/Bin/x86_64-linux/wvunpack5
It's again possible (likely) that in the future LMS incorporates WavPack 5 in the standard distribution making this unnecessary. Notice that when I copy, instead of completely overwriting wvunpack, I call it wvunpack5. The reason is so that when I update LMS, it won't overwrite wvunpack with potentially an older version. This way wvunpack5 will stay in place.
5. Now then, let's tell LMS that decoded WavPack can actually be streamed as DSD through the .dsf file format for those devices that can handle them. Go into "cd /etc/squeezeboxserver" and create a new custom-types.conf file with the following content (I just use sudo nano custom-types.conf in the directory for the nano text editor):
wvp wv audio/dsf audio
Save that file with only this single line...
6. Then create a new custom-convert.conf file telling LMS how to handle these DSD WavPack files (sudo nano custom-convert.conf) with the following content:
# FT:{START=--skip=%t}U:{END=--until=%v}
[wvunpack5] $FILE$ --dsf $START$ $END$ -o -
wvp flc * *
# FT:{START=--skip=%t}U:{END=--until=%v}D:{RESAMPLE=-r %d}
[wvunpack5] $FILE$ -wq $START$ $END$ -o - | [sox] -q -t wav - -t flac -C 0 -r 88200 -
Notice what we're doing here... If the device being streamed to can handle native DSD (.dsf), then the conversion will call upon the wvunpack5 binary which we copied above to output the data as .dsf format. For a device like the Pi 3 with piCorePlayer, this results in direct DSD playback, typically through DoP. However, for an older device like my Transporter which cannot handle DSD output, the file will be converted to FLAC using WAV output (-w decimates the DSD to 352.8kHz PCM), and the result is piped to SoX for resampling to 88.2kHz and output as FLAC. I found I had to specify resampling to 88.2kHz in order for it to play properly with my Transporter.
Remember, it's good to modify one's own custom-types.conf and custom-convert.conf files rather than modify types.conf and convert.conf directly. The custom files will not be overwritten when you update LMS every once awhile.
7. Almost there! Now we tell LMS to restart with the new settings in place:
systemctl restart logitechmediaserver
8. You can now go into Settings --> Advanced --> File Types in the LMS web settings and see this for the WavPack entries:
Notice WavPack now can stream using .dsf. And the FLAC conversion is using our wavpack5 binary piped into SoX. Nice and as expected...
9. That's it. Go test this out with one of your WavPack-DSD compressed albums to your piCorePlayer device, Touch, Transporter, etc...
You should be able to see that devices that can handle DSD like my piCorePlayer above streams to the DSD-enabled DAC so long as the setup with the DAC is correct (you can also check by playing uncompressed .dsf or .dff music to make sure it works). Likewise, devices like the Transporter and my Squeezebox Radio will play the transcoded DSD --> FLAC PCM at 24/88.2. I find that even older legacy devices like the Squeezebox 3 and Boom will stream the transcoded PCM just fine although I have run into a few occasions when the oldest of these devices (my Slim Devices Squeezebox 3) will stutter a little even connected over wired ethernet - possibly buffer issues. I actually haven't hooked up my Logitech Touch to double check, but I suspect it'll be fine.
C. Summary & loose ends...
There you go. A system to play compressed, metadata tagged DSD into the venerable Squeezebox Server / Logitech Media Server system. It does everything I want or need now including streaming DSD64 and DSD128 over DoP to my good ol' TEAC UD-501 DAC in use since 2013. Sounds wonderful.So far, there's only one significant anomaly to be aware of... The file library scanner knows about PCM WavPack but not DSD. So the album and song durations are not reported properly. For example, in the picture at the top, the "Beethoven Dreams Stereo" track is reported as about 26 minutes when it should only be 3:18 (the fact that it's a larger DSD128 file magnifies the error as well).
Decompression and transcoding remains quite efficient. With my i5-6500 (quad core, 3.2GHz) server machine, at most playback takes up 20% of the CPU cycles decompressing, transcoding, and downsampling to 88.2kHz when needed in the Linux/Ubuntu virtual machine. This is about the same amount of peak processing as Brutefir digital room correction with high resolution PCM/FLAC files.
What can I say, I'm very happy at this point with LMS :-). Digital room correction on, the ability to build very inexpensive and excellent quality streamers (using Pi3, etc...), and now incorporating DSD streaming into the mix without compromising compression or tagging. If LMS updated the scanning procedure with WavPack-DSD awareness for correct track durations, it'd be perfect.
Hope this works out for you... I have converted all 90 or so DSD albums I have over the last week and integrated them into the unified LMS music library. With nightly listening sessions, no issues with stability thus far.
---------------------------------------------
As I end off this week's post, I mentioned awhile back that I upgraded to an electric car back in September. Something that has become evident over the last couple months of use is the realization that if one loves music, and has to commute every day, the low noise floor of an EV is really quite desirable :-)! In fact, every once awhile when I turn off the radio or music, I still am surprised by just how quiet the drive is.
There ya go, Audiophile Tip #354: Get a nice car sound system, upgrade to an electric vehicle with good sound insulation and essentially no engine noise (of course one still hears road noise, wind, and other cars on the streets). This is how you make the most of those high bitrate MP3's encoded with a modern encoder on the go and appreciate high dynamic range masterings even more. A worthy upgrade to the audiophile who has already achieved what they desire in the acoustically treated sound room. Heck, getting a new car is cheaper than many "high-end" speakers these days...
Speaking of higher dynamic range masterings, for those Eagles fans out there who may not be aware, if you like the live Hell Freezes Over album, make sure to grab a copy of the original DVD and rip the 16/48 PCM soundtrack. It's of higher dynamic range (DR14) compared to the typical DR9-10 of the CD versions; especially of the later remasterings. Sounds great in the car :-).
For those interested in some new music with an old-school crooner charm and a little bit of an edge in some songs, check out Cameron Avery's Ripe Dreams, Pipe Dreams (2017, DR8). Nice to see the versatility of this young man - compare this album with the 80's retro-inspired synthpop Tame Impala album Currents (2015, DR5 - hmmmm) which is also a good listen if you're into the genre.
Stay real & enjoy the music, everyone!
ADDENDUM:
Jean-Francois just sent me this link for "UPABX" - the "useless" UPnP ABX testing tool :-).
Obviously he's being modest. Nice to know there is an ABX tool available for people using UPnP/DLNA streaming for testing...
ADDENDUM April 7, 2018:
For those who have upgraded to piCorePlayer 3.5.0, you'll need to go into the Beta tab under Squeezelite Settings and enable the Native/DoP patches. Only then can you access the "Device supports DSD/DoP" setting I mention above for the 250ms delay for switching between PCM and DSD.
Note also the "Upsample setting" above that I use for intermediate phase filtering along with the "Max sample rate" setting that I use with my TEAC UD-501 (all PCM upsampled to 352.8/384kHz) as discussed here.
Wavpack DSD support is available out of the box in Daphile (LMS based Linux distro) including the library scanner fix (patch merged now also into Audio::Scan 0.99 version).
ReplyDeleteNice!
DeleteLooking forward to the patch on the nightly binaries soon!
Thanks for these great articles. Up until now, tagging SACD ISO files hasn't been possible. This provides a method of tagging and compressing SACD ISOs by ripping them to dsf followed by conversion to Wavpack and tagging. I'm wondering if you can see any issues when using this method with multi-channel dsf files?
ReplyDeleteHi Archimago.
ReplyDeleteGreat guide, now we just need to have the patch so the length of the song is correct. You guide works fine under ubuntu 17.10 + latest nightly build.
Best Michaelvv.
Arch,
ReplyDeleteGreat job as usual.
I know you have said that modern USB Async dacs essentially make jitter a non-issue.
Do you have a take on the viability of coax SPDIF or hdmi?
Here is my senario: I am MCH. I run hdmi out of a very good and very tricked out streamer, PinkFaun. Absurdly good power supply, shielding, i7700 and super-upgraded Conner Winfield clock.
This runs via hdmi to an Oppo 103 with Vanity hd board so the Oppo is essentially a DDC. The Oppo is also upgraded with LPS, and clocking, etc.
I then run coax SPDIF out to three dacs for MCH.
Can you make an estimate on possible jitter in this case and how it might compare to USB out of the streamer for instance.
Would a high quality modern dac render jitter to be inconsequential just like USB in this case?
Thanks very much and Happy Holidays,
sk16
This article on integrating WavPack 5 compressed files is a gold mine for anyone looking to handle these types of files. The writer presents the guide in an impressively easy-to-understand format, making it possible even for beginners to follow through successfully. It reminds me of going to a bearing store where the staff explains the differences and uses of various bearings, leaving you feeling like a bearing expert. Overall, this is an exemplary piece of educational content.
ReplyDelete