PiTunes is a high quality standalone audio file player based on the Raspberry Pi. It has 1TB of storage and will play just about any audio file format including Apple Lossless and FLAC, at bit rates up to 24 bits and 96kHz, as well as internet radio including most of the BBC stations. The audio output is handled by Borge Strand-Bergesen’s QNKTC DAC, which I modified to add coax and optical digital outputs. The digital output has been verified bit-perfect at 24 bit, 96kHz.

All software used is free and open source. Even the QNKTC DAC has open schematics and firmware.

An early prototype.

I have been working on this project for almost 2 years on and off, but I was only recently able to get rid of the last few glitches at high bit rates, using the latest R-Pi kernel with some help from overclocking.


The software is based on the Raspbian Linux distro for Raspberry Pi, and the popular MPD “Music Player Daemon”, with the following added features:

Samba (“Windows File Sharing”) server allows uploading music to the internal hard drive from a PC or Mac.

User interface based on the ncmpc client for mpd, with a modified version of pikeyd to map the front panel buttons to keypresses. (I added code to handle a rotary encoder and map it to the up and down arrow keys.)

BBC radio proxy: a slightly tweaked version of Ben Lancaster’s BBCRadioProxy (added a few more stations)

Temp and log directories redirected to RAM to reduce write traffic on the SD card.

An image of the SD card is available on request. 🙂

Under construction

The key to the success of this project was probably the QNKTC DAC. 2 years ago, the Pi had serious issues with its USB stack and could not drive most USB soundcards reliably even at 44.1kHz and 16 bits. The reason being that they required USB1.1 split transactions and the Pi could not handle these properly. However, the QNKTC is a USB2.0 asynchronous device, a different protocol that avoided the problem area and gave pretty good results even with the old kernel.

Experimental digital output

The Pi’s USB has been progressively improved, and USB1.1 audio may work quite well now, though I haven’t tested it lately. The output of PiTunes was always almost perfect except for a minor glitch that appeared every few minutes, especially at higher bit rates. I just recently figured out that this was due to filesystem activity keeping the kernel busy and causing it to drop an occasional USB packet. I fixed it by overclocking the Pi to the max.

User interface with 9 carefully chosen buttons


Raspberry Pi Model B

QNKTC USB DAC (modified to add SPDIF output)

Edimax EW-7811UN wifi dongle

3.5″ TFT monitor (composite input, for car rear view camera)

1TB “Seagate Expansion” USB hard disk

USB hub

Astec switchmode power supply


One Reply to “PiTunes”

Leave a Reply

Your email address will not be published. Required fields are marked *