A simple script used to configure a docker-compose stack for Tidal Connect.
All the hard work has been done by the owner of the repository mentioned here and in the other repositories from which this one has been forked. I am just trying to provide a way to run their container more easily in certain environments (where the index of your audio device is not the same on every restart).
This entirely relies on this repository from GitHub user TonyTrump. A big thank you to the author for the great work.
It will also use his docker image.
I created this repository because it was very inconvenient for me to figure out the string to put for the PLAYBACK_DEVICE variable. I even failed for one of my DAC, I don't know honestly why, but as far as I understand, the ifi-pa-devs-get
for some reason refuses to see the device. The most relevant issue I found about this issue is this, but it does not seems to have an easy solution.
Additionally, even if you can specify the correct string for your DAC, I found that the resulting configuration would be error-prone as the string reports both the device name and the device index. AFAIK the index can change across restarts, so outside of a known and controlled setup (which is probably represented by the Ifi devices) this situation can an will lead to errors or unwanted configurations.
Keep in mind that the audio device index can also be changed because one time the (usb) device is powered on during boot, and another time it isn't.
This is my experience, unless I am missing something obvious. If so, I will be glad to be corrected.
The work in this repository consists in slightly altering the container startup phase (the entrypoint.sh
file), in such a way that a custom /etc/asound.conf
is created with (hopefully) the correct device index, regardless of the order of the audio devices, which can vary across restarts. The underlying application then always uses the default
audio device.
You will need a single-board computer (or anyway, a computer) with an armhf architecture (arm64 should work as well), running docker
and docker-compose
.
A Raspberry Pi 3/4 will work. I am also running this on as Asus Tinkerboard. With this hardware, my suggestion is to not allow it to scale down the cpu frequency too much, or you might experience every kind of crackling noises along with what will remain of your music.
From the repository directory, just run the configure.sh
bash script, specifying the following parameters:
PARAM | DESCRIPTION |
---|---|
-n | Sound card name (e.g. DAC), used if card index is not specified |
-i | Sound card index. Not recommended. If not specified and also card name isn't, it defaults to -1 |
-f | Friendly name, defaults to TIDAL connect |
-m | Model name, defaults to Audio Streamer |
-c | MQA Codec, defaults to false |
-p | MQA Passthrough, defaults to false |
-t | Sleep time in seconds be, defaults to 3 |
I recommend to use the -n
parameter instead of -i
, because the index of the devices might change across restarts.
If you already used the configure.sh
command and you are experiencing issues (because of the card has changed its index), you can run the command again. In the latest version, the card index is calculated during the container startup phase and hopefully there will not be any need to use configure.sh
again unless you change the audio device you want to use.
Configure for sound card named "DAC", using friendly name "Aune S6 USB DAC" and model name "Asus Tinkerboard":
bash configure.sh -n DAC -f "Aune S6 USB DAC" -m "Asus Tinkerboard"
If no error is reported, you will find a new (or updated) .env
file.
If you find a spurious .asound.conf
file there, it probably was generated by a previous version of the configure.sh
script, and you can safely delete it.
So now you can run the docker-compose.yaml
as usual:
docker-compose up -d
It is possible to use this solution for easy installation of Tidal Connect on Moode Audio.
It is required to have a ssh connection to the moode audio box.
Docker is also a prerequisite. We can install the necessary packages with the following commands:
sudo apt update
sudo apt install docker.io docker-compose
sudo usermod -a -G docker pi
Logoff your current ssh session, then log back in. On my Moode box, I have a Hifiberry Dac+ Pro Hat, so when I use the command:
cat /proc/asound/cards
I get:
pi@moode-living:~/git/tidal-connect $ cat /proc/asound/cards
0 [sndrpihifiberry]: HifiberryDacp - snd_rpi_hifiberry_dacplus
snd_rpi_hifiberry_dacplus
Great, Moode has just disabled the onboard audio and set the Hifiberry HAT as the default card.
So let's configure Tidal Connect:
./configure.sh -i 0 -f "Moode Living Aux1" -m "Raspberry Pi 3b"
Replace the second and third strings to your liking. Once configured, start the service as usual:
docker-compose up -d
On DietPi (which I am running on my Asus Tinkerboard), you might need to enable avahi-daemon, if this is not enabled yet.
You might find the following on the logs:
[tisoc] [error] [avahiImpl.cpp:358] avahi_client_new() FAILED: Daemon not running
This can be fixed by installing the avahi-daemon. It is not installed by default on DietPi, so we can installing it with this command:
sudo apt install avahi-daemon
An already started tidal-connect container should start working immediately, at least that is what happened with my setup.
Date | Comment |
---|---|
2023-07-07 | Fixed asound.conf generation from card index, see issue (#2) |
2023-06-02 | First unfolding seems to be working |
2023-06-02 | Some effort to avoid resampling |
2023-06-02 | MQA passthrough defaults to false |
2023-06-01 | Using hardware mode |
2023-06-01 | Resolve device name at container startup |
2023-05-29 | First working version |