GioF71 / tidal-connect

Simple script for configuring Tidal Connect with Docker (also on Volumio, MoodeAudio, OSMC)
MIT License
65 stars 6 forks source link

Is it possible to run TidalConnect on MoOdeAudio? #103

Closed tomazi78 closed 4 months ago

tomazi78 commented 4 months ago

I have RPi4. Is it possible to run TidalConnect on MOodeAudio? I performed 'install docker', 'clone' and 'update' one by one. The option to select TIDALCONNECT does not appear in the application list. What am I doing wrong? Is something missing? Does the latest MOode system block the ability to activate this script?

GioF71 commented 4 months ago

Hello, the instructions "cd" and "git clone ..." are separate: try to execute "cd" first (which will bring you to home where you probably are already), then execute the second command ("git clone ...").

Edit: yes it is possible to run on Moode Audio

tomazi78 commented 4 months ago

Sorry, I didn't see you would reply so quickly. I edited my message. I attached the photo accidentally. I had no problems with installation. I followed all the steps

GioF71 commented 4 months ago

ops

tomazi78 commented 4 months ago

It just doesn't work. The RPi is connected to the network via RJ45 and the TIDALCONNECT selection does not appear in the TIDAL application - neither in Android on the phone nor in iPad on iOS. What am I missing? Is there anything else I need to install?

GioF71 commented 4 months ago

Uhm please post the logs of the container.

cd $HOME/tidal-connect
docker-compose logs

also please post the output of

cat /proc/asound/cards

and

aplay -L

tomazi78 commented 4 months ago

"docker-compose logs" command doesn't work

screen moode3 screen moode2 screen moode moode.log

GioF71 commented 4 months ago

Did you install docker-compose?

sudo apt-get update
sudo apt-get install docker.io docker-compose
sudo usermod -a -G docker $USER
tomazi78 commented 4 months ago

yes docker

tomazi78 commented 4 months ago

I installed docker-compose again and wanted to download the "log" screen moode4

GioF71 commented 4 months ago

Ok, we need to start the container. After docker installation, you need to close your terminal connection and open a new one. You probably already did that. About the soundcard, I assume you want to use the usb dac.

So, please execute these commands:

cd $HOME/tidal-connect
echo "CARD_NAME=v12" > .env
docker-compose pull
docker-compose up -d
docker-compose logs -f
tomazi78 commented 4 months ago

This is the log after installing and restarting RPi4. There is an option to enable TIDAL-CONNECT in the TIDAL application, but unfortunately the function does not work. On iOS iPad, when switching to TIDALconnect, the music stops and pressing the PLAY button does nothing - the music progress bar does not move (as if there was a pause). On Android it is the same and an additional message "error connecting to the server" appears. I have the TIDAL HiFi Plus plan

boot1 boot2 boot3 boot4 boot5 boot6

tomazi78 commented 4 months ago

here is the installation log: screen moode11 screen moode12 screen moode13

GioF71 commented 4 months ago

Maybe the Audio config is wrong. Try removing the .env file and restart:

cd $HOME/tidal-connect
rm .env
docker-compose up -d --force-recreate
GioF71 commented 4 months ago

Your dac should be the default device anyway from what I see from one of the previous screenshots.

tomazi78 commented 4 months ago

The only thing that has changed is that when I switch to TidalConnect, the music progress bar moves, but the sound does not go to the amplifier. When I run RPi, MoOdeAudio starts on the last selected radio station from the Internet (and that's good), but when I turn on TidalConnect, the Internet radio still plays and I can't hear the music from TIDAL

GioF71 commented 4 months ago

it's probably going to the onboard audio for some reasons. You can monitor you onboard with this, while you are playing:

watch cat /proc/asound/card0/pcm0p/sub0/hw_params

and the dac (assuming it's at index 2):

watch cat /proc/asound/card2/pcm0p/sub0/hw_params

Then check again this:

cat /proc/asound/cards

Your card should be at index 2 if nothing changed from before. If so, create the .env file accordingly:

cd $HOME/tidal-connect
echo "CARD_INDEX=2" > .env
docker-compose up -d --force-recreate
docker-compose logs -f

Let's see if this works. Maybe we might need to also set audio format to S32_LE. So if this does not work you can try also:

cd $HOME/tidal-connect
echo "CARD_INDEX=2" > .env
echo "CARD_FORMAT=S32_LE" >> .env
cat .env
docker-compose up -d --force-recreate
docker-compose logs -f
hv6478 commented 4 months ago

In moOde settings under Audio, what is your Volume type set as? At least for me, it must be Software or Fixed (0dB) to get sound. Give that a try as it seems your audio device is set correctly as the SMSL. It is odd that internet radio is working and Tidal Connect can't grab it. Try pausing internet radio, or restarting the MPD (without auto-play enabled) and testing when there is no other stream going, It could be that internet radio is stealing exclusivity (much like Tidal Connect does when connected). But I'm not sure if there is a visual confirmation of this happening, so further testing may be needed.

You can try indicating "v12" as the card name again and see if that works after a fresh install perhaps. Hard to say but Gio is more of an expert than I am :D

GioF71 commented 4 months ago

Of course I was assuming that nothing else was playing on moode audio on the same audio output. Setting "CARD_NAME=v12" apparently did not work, maybe we need to set format to S32_LE. Every dac has its quirks, this Tidal Connect application is quite old now, so it requires some work to make the dac work. I made it work on every dac I tried until now, but some times it has not been a super-easy task. Usually modern app like mpd/squeezelite adapt on their own to the features of the dac. Not this one. The worst has been an android box with LibreElec/CoreElec installed. Those boxes worked perfectly in kodi, but it was not easy to make Tidal Connect work. And, when using Armbian (arm64) on the same box, the app was starting but it immediately started to flood the system logs with an emulation warning. Even with this log suppressed, the cpu load was high, and the application would not run properly, there were glitches, noise, etc.

hv6478 commented 4 months ago

That's very interesting and I suppose makes sense with the different ways various devices communicate.

I wonder if it has anything to do with the way moOde allows communications with the DAC. Seeing the settings in the moOde > Audio page may help a bit.

All the best with this one!

GioF71 commented 4 months ago

Well the main player used by moode is mpd, much more updated than the underlying binary used here, and inherently different ... so looking at the mpd configuration file created by moode might help, but not necessarily.

GioF71 commented 4 months ago

anyway @tomazi78, if nothing still worked, maybe post the contents of the mpd.conf file. This should be obtained with a

cat /etc/mpd.conf

tomazi78 commented 4 months ago

In moOde settings under Audio, what is your Volume type set as? At least for me, it must be Software or Fixed (0dB) to get sound. Give that a try as it seems your audio device is set correctly as the SMSL. It is odd that internet radio is working and Tidal Connect can't grab it. Try pausing internet radio, or restarting the MPD (without auto-play enabled) and testing when there is no other stream going, It could be that internet radio is stealing exclusivity (much like Tidal Connect does when connected). But I'm not sure if there is a visual confirmation of this happening, so further testing may be needed.

You can try indicating "v12" as the card name again and see if that works after a fresh install perhaps. Hard to say but Gio is more of an expert than I am :D

By chance, one thing became clear. You wrote to stop the radio (MPD). Sorry, I didn't know how to do it in the MoOde system, I only found PAUSE/PLAY radio, but it didn't work when I pressed pause. Today for some reason (I don't know why) an error appeared (it happens sometimes). If I pressed PLAY, the radio would start playing, but I didn't press PLAY. I took advantage of this moment and turned on TidalConnect and it started playing. Only the volume control from the tablet does not work. This is just a quick one, I'm writing this after a few minutes of use and I don't know of any more errors photo_2024-02-16_18-19-21

tomazi78 commented 4 months ago

cat /etc/mpd.conf

Tidal Connect is playing while this file is being generated

mpd1 mpd2

GioF71 commented 4 months ago

So basically the audio card was locked, did I understand it clearly? In any case, use the watch commands on the audio card to understand if it is open or not. Given the audio card "v12", you can watch using:

watch cat /proc/asound/v12/pcm0p/sub0/hw_params

If it doesn't say "closed", it means that some app is using it

GioF71 commented 4 months ago

No particular settings in mpd.conf, it's using index 2 which should be the same as CARD_INDEX=2 in this tidal-connect

tomazi78 commented 4 months ago

watch cat /proc/asound/v12/pcm0p/sub0/hw_params

clock

GioF71 commented 4 months ago

does this happen with tidal playing?

tomazi78 commented 4 months ago

does this happen with tidal playing?

Yes, he plays all the time now

tomazi78 commented 4 months ago

In moOde settings under Audio, what is your Volume type set as? At least for me, it must be Software or Fixed (0dB) to get sound. Give that a try as it seems your audio device is set correctly as the SMSL. It is odd that internet radio is working and Tidal Connect can't grab it. Try pausing internet radio, or restarting the MPD (without auto-play enabled) and testing when there is no other stream going, It could be that internet radio is stealing exclusivity (much like Tidal Connect does when connected). But I'm not sure if there is a visual confirmation of this happening, so further testing may be needed. You can try indicating "v12" as the card name again and see if that works after a fresh install perhaps. Hard to say but Gio is more of an expert than I am :D

By chance, one thing became clear. You wrote to stop the radio (MPD). Sorry, I didn't know how to do it in the MoOde system, I only found PAUSE/PLAY radio, but it didn't work when I pressed pause. Today for some reason (I don't know why) an error appeared (it happens sometimes). If I pressed PLAY, the radio would start playing, but I didn't press PLAY. I took advantage of this moment and turned on TidalConnect and it started playing. Only the volume control from the tablet does not work. This is just a quick one, I'm writing this after a few minutes of use and I don't know of any more errors photo_2024-02-16_18-19-21

While TidalConnect is playing and I want to turn on PLAY on the radio, an error appears. photo_2024-02-16_19-01-13

GioF71 commented 4 months ago

Can you share the working .env file? do this

cat $HOME/tidal-connect/.env

GioF71 commented 4 months ago

Look if there are some timers, wake-up alarms, or some configuration that wants to play things automatically ...

GioF71 commented 4 months ago

While TidalConnect is playing and I want to turn on PLAY on the radio, an error appears.

Yes, that's unfortunately expected. This Tidal Connect app does not release the audio card if you pause the playback. The only way to have the audio card available is to disconnect the app from the Tidal Connect device.

tomazi78 commented 4 months ago

cat $HOME/tidal-connect/.env

env

tomazi78 commented 4 months ago

Look if there are some timers, wake-up alarms, or some configuration that wants to play things automatically ...

I already know that before I choose Tidal Connect, I have to restart MPD and then it works. MPD has autostart, because when I turn on RPi, the last radio station I listened to starts, and I like that.

mpd mpd11

tomazi78 commented 4 months ago

Is it possible to try to fix the volume controls?

tomazi78 commented 4 months ago

Does the update break Tidal Connect? IMG_1677

GioF71 commented 4 months ago

Does the update break Tidal Connect? IMG_1677

It should not!

GioF71 commented 4 months ago

cat $HOME/tidal-connect/.env

env

Would you like to try with CARD_NAME=v12 instead? It should work the same way. If you want to try:

cd $HOME/tidal-connect
echo "CARD_NAME=v12" > .env
docker-compose up -d

Should you need to revert:

cd $HOME/tidal-connect
echo "CARD_INDEX=2" > .env
docker-compose up -d
GioF71 commented 4 months ago

Is it possible to try to fix the volume controls?

We can try... post the output of this command:

amixer controls | grep Master

tomazi78 commented 4 months ago

amixer controls | grep Master

he may not be able to do something, but it doesn't work

volume1

GioF71 commented 4 months ago

Actually that's what's good for us! There is not any device named master. I have created two files in userconfig. Try the following:

cd $HOME/tidal-connect
git config pull.rebase false
git pull
echo "ASOUND_FILE_PREFIX=smsl-a8-softvol" > .env
docker-compose up -d
tomazi78 commented 4 months ago

docker-compose up -d

Well, something went wrong. There is no sound at all from TidalConnect. The music progress bar moves. I had previously stopped MDP so it wasn't blocked by the radio. Unfortunately, you can't hear anything

vol

GioF71 commented 4 months ago

Ok you can revert to the working config using the instructions I sent you before. But if you want, try and repeat the last changes but add '-32' to the prefix.

GioF71 commented 4 months ago

Anyway please post container logs

docker-compose logs -f

It would be great if you can post the text instead of images. If you are using putty you just need to select some text to copy to the clipboard

tomazi78 commented 4 months ago

OK, możesz powrócić do działającej konfiguracji, korzystając z instrukcji, które Ci wcześniej wysłałem. Ale jeśli chcesz, spróbuj powtórzyć ostatnie zmiany, ale dodaj „-32” do przedrostka.

I followed these instructions and still no sound

pi@moodeaudio:~ $ cd $HOME/tidal-connect echo "CARD_INDEX=2" > .env docker-compose up -d Recreating tidal-connect ... done pi@moodeaudio:~/tidal-connect $

GioF71 commented 4 months ago

OK, możesz powrócić do działającej konfiguracji, korzystając z instrukcji, które Ci wcześniej wysłałem. Ale jeśli chcesz, spróbuj powtórzyć ostatnie zmiany, ale dodaj „-32” do przedrostka.

I followed these instructions and still no sound

pi@moodeaudio:~ $ cd $HOME/tidal-connect echo "CARD_INDEX=2" > .env docker-compose up -d Recreating tidal-connect ... done pi@moodeaudio:~/tidal-connect $

Ok then post again

cat /proc/around/cards

tomazi78 commented 4 months ago

cat /proc/around/cards

pi@moodeaudio:~/tidal-connect $ ~cat /proc/around/cards -bash: ~cat: command not found pi@moodeaudio:~/tidal-connect $ cd pi@moodeaudio:~ $ cat /proc/around/cards cat: /proc/around/cards: No such file or directory pi@moodeaudio:~ $ cd $HOME/tidal-connect pi@moodeaudio:~/tidal-connect $ cat /proc/around/cards cat: /proc/around/cards: No such file or directory pi@moodeaudio:~/tidal-connect $

hv6478 commented 4 months ago

I think it's asound probably just a little typo. Try that!

GioF71 commented 4 months ago

Anyway please post container logs

docker-compose logs -f

It would be great if you can post the text instead of images. If you are using putty you just need to select some text to copy to the clipboard X

cat /proc/asound/cards

Sorry I am using a phone

tomazi78 commented 4 months ago

cat /proc/asound/cards

pi@moodeaudio:~/tidal-connect $ cat /proc/asound/cards 0 [b1 ]: bcm2835_hdmi - bcm2835 HDMI 1 bcm2835 HDMI 1 1 [Headphones ]: bcm2835_headpho - bcm2835 Headphones bcm2835 Headphones 2 [v12 ]: USB-Audio - SMSL A8 v1.2 SMSL SMSL A8 v1.2 at usb-0000:01:00.0-1.2, high speed pi@moodeaudio:~/tidal-connect $