Sunday, 1 July 2018

Kodi and DACs from a RPI to an amplifier

There are a number of options to connect a Raspberry Pi to an stereo amplier but one option is to use a DAC hat card such as an IQAudio DAC with RCA jacks. With the hardware in place it's all about the software to library/index/serve your music and to provide a pleasant user experience to select/queue/control your music - this typically means to control your music via a IOS-based smartphone/tablet.

In the past I've used Volumio which is a standlone system with MPD as the core of it's music handling. With a MPD-based setup you may access your music via one of the few MPD clients but this experience isn't great - ympd is a basic http/REST based option allowing any web browser to connect/select music etc but is very basic. Of course, Volumio's web-based interface is pretty but it is not free from problems: the MPod app works but it is a unmainted 32bit app and suffers from the impending death with the latter IOS 11.x releases only supporing 64bit apps,

However, trying to run other services, notably Kodi and some bespoke services, on Volumio is an utter pain. This has led to running the base RPI distribution and adding my required services: but we're now back at the original problem of getting the software to provide the desired UX.

A Kodi Based Solution

With kodi 17.3 installed we have most of the solution in place although there are reported latency problems with large music libraries.

Kodi provides apps for both IOS/andriod which acts as a remote control but provides the functionality to queue and select your music. Perfect. Additinoally, there is a clone/copy called Kodi Remote that seems to offer slightly more functionlity. Both apps are free.


Kodi remote on ipad - viewing ablum

The annoying difference between the IPhone vs IPad app seems to be the inability to change the volume but that's a minor inconvience.

Kodi remote on ipad - adding to album playlist

Kodi using the DAC

Kodi allows to select the audio output, typically the HDMI or alsa outputs. With the DAC installed and connected to our amplier we'd like to use the DAC for kodi's output.

Using aplay -l we can confirm the DAC is recognised and working: we can use aplay -D ... to force playing music files to the DAC though alsa. However with the default RPI onboard sound enbaled we will not be able to select the alsa/DAC option.

It appears that Kodi will only present one alsa device; there are options to swap the alsa device options but I found this to hhave no impact on Kodi.

The solution to allow Kodi to see the alsa DAC device is to diable the RPI onboard device by modifying /boot/config.txt and commenting out/removing the line:
# dtparam=audio=on
Rebooting the RPI, we find that we only have one alsa device:
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: IQaudIODAC [IQaudIODAC], device 0: IQaudIO DAC HiFi pcm512x-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0

kodi select audio screen
In Kodi we are now able to see the alsa subsystem presenting the DAC as required.

No comments:

Post a Comment