{"id":72,"date":"2013-12-05T22:07:31","date_gmt":"2013-12-05T21:07:31","guid":{"rendered":"http:\/\/techblog.vindvejr.dk\/?p=72"},"modified":"2013-12-05T22:07:31","modified_gmt":"2013-12-05T21:07:31","slug":"playing-multi-channel-flacs-on-raspbmc","status":"publish","type":"post","link":"https:\/\/techblog.vindvejr.dk\/?p=72","title":{"rendered":"Playing multi-channel FLAC&#8217;s on Raspbmc"},"content":{"rendered":"<p>About a year ago I bought a <a href=\"http:\/\/www.raspberrypi.org\/\" title=\"Raspberry Pi\">Raspberry Pi<\/a> and installed <a href=\"http:\/\/www.raspbmc.com\/\" title=\"Raspbmc\">Raspbmc<\/a>. I wanted to use this cheap little gadget as a media center, filling some of the holes in my existing home entertainment setup. One of the things I was hoping to get out of it was the ability to play multi-channel (5.1) FLAC&#8217;s through HDMI to my surround receiver. However, I never got this to work. The same goes for the primary goal &#8211; being able to playback my DVD collection from ISO files, but that&#8217;s another story&#8230;<\/p>\n<p>The setup:<\/p>\n<ol>\n<li>The FLAC&#8217;s are 24 bit with a sample rate of 96 kHz.<\/li>\n<li>I&#8217;m using NFS for efficient file transfer from my NAS.<\/li>\n<li>The average bitrate for the files is below 10 Mbps.<\/li>\n<\/ol>\n<p>Raspbmc will try to play the files, but immediately chokes or freezes. I&#8217;m ruling out network limitations, since the Pi is wired and able to stream 1080p video at higher bitrates. I had completely given up, thinking it was a shortcoming of Raspbmc itself, when I suddenly, by coincidence, discovered that one of my albums played perfectly. So I started investigating the difference between this album and the all the others that didn&#8217;t work. The difference was the bitrate, which was only 48 kHz for the working album.<\/p>\n<p>The next step was to downsample a song from 96 kHz to 48 kHz &#8211; and this turned out good as well. So now I&#8217;ve downsampled all my albums, and can play them all on the Pi. A bit of research led me to <a href=\"http:\/\/sox.sourceforge.net\/\" title=\"SoX\">SoX<\/a>, one of the best free tools for downsampling audio &#8212; amongst a lot of other things. I use it like this:<\/p>\n<pre>\r\nsox -S orig96.flac -r 48000 -b 24 conv48.flac\r\n<\/pre>\n<p>I had to compile it myself, because the version included in my CentOS installation didn&#8217;t support FLAC. This was completely straight-forward (configure, make, make install), probably because I already had libFLAC installed. The only think I&#8217;m unsure about is if I&#8217;ve missed some option to get the best quality downsampling.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>About a year ago I bought a Raspberry Pi and installed Raspbmc. I wanted to use this cheap little gadget as a media center, filling some of the holes in my existing home entertainment setup. One of the things I &hellip; <a href=\"https:\/\/techblog.vindvejr.dk\/?p=72\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5,7],"tags":[],"class_list":["post-72","post","type-post","status-publish","format-standard","hentry","category-linux","category-raspberry-pi"],"_links":{"self":[{"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=\/wp\/v2\/posts\/72","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=72"}],"version-history":[{"count":5,"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=\/wp\/v2\/posts\/72\/revisions"}],"predecessor-version":[{"id":77,"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=\/wp\/v2\/posts\/72\/revisions\/77"}],"wp:attachment":[{"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=72"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=72"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/techblog.vindvejr.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=72"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}