-
1Gather the parts
A Raspberry Pi 4 with a 16GB or larger microSD card, an ES9038Q2M I2S DAC HAT, a 5V 3A USB-C supply, and headphones or an amplifier.
The DAC board I used is sold as the InnoMaker HiFi DAC PRO and silkscreened SkyLark DAC. Same hardware, two names, so search either.
Read this before going further: the control daemon has no authentication. Anyone who can reach port 8080 can upload files, delete files, and shut the machine down. That is fine on a home network you control, and unsafe exposed to the internet. Do not port forward it.
-
2Flash the OS
Raspberry Pi OS Lite 64-bit, written with Raspberry Pi Imager.
Before writing, open the settings gear and set a hostname, your username and password, and enable SSH. Add Wi-Fi credentials if you are not using Ethernet. This device never needs a monitor or keyboard, so set all of it here.
-
3Mount the HAT and boot
With the Pi powered off, seat the DAC onto the full 40-pin header. Power up, wait about 30 seconds, then connect over SSH.
Set a DHCP reservation for the Pi in your router while you are at it. Otherwise the address moves and you spend an evening hunting it, as I did.
-
4Enable the DAC and disable everything else
In
/boot/firmware/config.txt, setdtparam=audio=off, add,noaudioto the existingdtoverlay=vc4-kms-v3dline, and adddtoverlay=i-sabre-q2mat the end.The
noaudiomatters more than it looks. Without it the HDMI audio devices and the DAC race at boot, the card numbering changes between reboots, and audio breaks at the worst possible moment.After a reboot,
aplay -lshould list exactly one card, named DAC. -
5Work around the 16 bit driver bug
The i-sabre-q2m driver claims S16_LE support, but in 16 bit mode the I2S bit slots misalign on the ES9038Q2M, which wants 32 bit frames. You get recognisable music buried in harsh noise, with no buffer underruns to explain it.
Create
~/.asoundrcwith a plug device that converts to S32_LE before the hardware. The exact config is in the repository README.To hear it for yourself, run
speaker-testagainstplughw:DAC,0and then against the plug device. The first is noise, the second is a clean tone. -
6Install and configure MPD
Install
mpdandmpc, then in/etc/mpd.confset your music directory and user, and configure the ALSA output to address the card by name ashw:DAC,0rather than by index.Set
auto_resample,auto_formatandauto_channelstono. Those three lines are what make playback bit perfect, and without them ALSA quietly converts everything.Hand over MPD's state directory with
chown, enable the service, then copy some music across and confirm it plays. -
7Install the control daemon
Clone the repository into
~/artifact, create a virtual environment, install the requirements, and run it. Full commands are in the repository README.Open
http://your-pi-address:8080from any browser on the network. -
8Run it at boot
Create a systemd unit for
artifactd, enable it, and the Pi boots straight into being a music player with no terminal needed afterwards. -
9Optional, shutdown from the interface
A single sudoers line lets the power button in the interface actually halt the machine. It also means anyone who can reach port 8080 can shut your Pi down, so add it only if that is acceptable on your network.
-
10Use it
The reel spins while a track plays. Drag it to scrub, hold it to pause under your hand. Centre pad plays and pauses, long press stops. Up and down move through the queue, left and right change screens. Triggers on the right edge are fast forward and rewind. The knob on the top edge is volume, one detent per step. The M button switches between tape and vinyl.
Drag audio files onto the device from a desktop browser to upload, or use the add music row in the system screen from a phone.
Noman Shah
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.