GioF71 / tidal-connect

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

no sound with max/mqa #175

Closed Andy-Voigt closed 1 month ago

Andy-Voigt commented 1 month ago

Hello,

i am running this container on a rasberry pi 2 with moode. The rasberry is connected to a hifiberry digi+ head. The .env is complete default. Tracks with "high" works but not tracks with max/mqa. Any help would be nice.

GioF71 commented 1 month ago

Hello, I also have two hifiberry digi+, each on a Pi 3, and they have always been quite problematic with high sampling rates. I found that disabling wifi and bluetooth on the Pi3 (but mostly wifi) helps a lot. I cannot guarantee that this will work on a Pi2 as well, I don't own one. But since you are running moode you can easily disable those features, assuming you are running your pi with a wired connection. In any case, have a lot at the system messages running a:

dmesg -T

so we can see if you are experiencing the same issue I had. You might find some "DMA" related issues. Please post the output of that command.

Let me know if this helps.

GioF71 commented 1 month ago

Uhm, I see the Pi2 doesn't even have wifi and/or bluetooth modules. So the solution probably does not apply unless you have external dongles. The Pi2 might simply be too underpowered for those high sampling rates. Any chance you can try a Pi3/Pi4?

GioF71 commented 1 month ago

Hello, did you solve your issue?

Andy-Voigt commented 1 month ago

Not yet i havent used it at all.

Andy-Voigt commented 1 month ago

Here is a log of the docker container:

Starting TIDAL Connect ...
STARTING TidalConnect services, version: 1.1.3
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
Cannot connect to server socket err = No such file or directory
Cannot connect to server request channel
jack server is not running or cannot be started
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
STARTED TidalConnect services.
[2024-05-20 18:32:30.490] [tisoc] [warning] [PlaybackControllerImpl.cpp:472] Illegal state:1
[2024-05-20 18:32:31.027] [tisoc] [warning] [logger.cpp:22] [audio_worker.cpp:321] Attempting to initialize a decoder without initial data!

dmesg is empty.

GioF71 commented 1 month ago

is the repository up-to-date? Unless you have cut the output, it should display the entrypoint.sh version.

Can you try this:

cd $HOME/tidal-connect
git config pull.rebase false
git pull

then recreate the container:

docker-compose up -d --force-recreate
docker-compose logs -f

and then post the output again. Anyway in the previous logs, nothing is wrong. Also post the output of

cat /proc/asound/cards

and also the output of

aplay -L

Andy-Voigt commented 1 month ago
andy@moode:~/tidal-connect $ git config pull.rebase false
andy@moode:~/tidal-connect $ git pull
Already up to date.
andy@moode:~/tidal-connect $ docker-compose up -d --force-recreate
Recreating tidal-connect ... done
andy@moode:~/tidal-connect $ docker-compose logs -f
Attaching to tidal-connect
tidal-connect    | Tidal Connect - https://github.com/GioF71/tidal-connect.git - entrypoint.sh version 0.1.7
tidal-connect    | Tidal Connect - https://github.com/GioF71/tidal-connect.git - common.sh version 0.1.5
tidal-connect    | FRIENDLY_NAME=Moode  Tidal
tidal-connect    | MODEL_NAME=Raspberry Pi
tidal-connect    | MQA_CODEC=false
tidal-connect    | MQA_PASSTHROUGH=false
tidal-connect    | CARD_NAME=
tidal-connect    | CARD_INDEX=
tidal-connect    | CARD_DEVICE=
tidal-connect    | CARD_FORMAT=
tidal-connect    | CREATED_ASOUND_CARD_NAME=
tidal-connect    | ENABLE_SOFTVOLUME=yes
tidal-connect    | ENABLE_GENERATED_TONE=yes
tidal-connect    | ASOUND_FILE_PREFIX=
tidal-connect    | FORCE_PLAYBACK_DEVICE=
tidal-connect    | SLEEP_TIME_SEC=3
tidal-connect    | RESTART_ON_FAIL=1
tidal-connect    | RESTART_WAIT_SEC=10
tidal-connect    | CLIENT_ID=
tidal-connect    | LOG_LEVEL=3
tidal-connect    | File [asound.conf] has not been provided
tidal-connect    | File /etc/asound.conf does not exist.
tidal-connect    | Entering write_asound_if_needed ...
tidal-connect    | using sysdefault ...
tidal-connect    | Completed write_asound_if_needed.
tidal-connect    | File [/etc/asound.conf] not found.
tidal-connect    | PLAYBACK_DEVICE=[sysdefault]
tidal-connect    | Starting Speaker Application in Background (TMUX)
tidal-connect    | Sleeping for a while (3 seconds)...
tidal-connect    | ENABLE_GENERATED_TONE=[yes]
tidal-connect    | Generated tone is enabled
tidal-connect    | certificate_path=[/app/ifi-tidal-release/id_certificate/IfiAudio_ZenStream.dat]
tidal-connect    | COMMAND_LINE=/app/ifi-tidal-release/bin/tidal_connect_application          --tc-certificate-path /app/ifi-tidal-release/id_certificate/IfiAudio_ZenStream.dat          --playback-device sysdefault          -f "Moode  Tidal"          --model-name "Raspberry Pi"          --codec-mpegh true          --codec-mqa false          --disable-app-security false          --disable-web-security false          --enable-mqa-passthrough false          --log-level 3          --enable-websocket-log "0"
tidal-connect    | Trying a short tone ...
tidal-connect    | Playing WAVE '/assets/audio/short-low-tone.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
tidal-connect    | tone_played=[1]
tidal-connect    | Starting TIDAL Connect ...
tidal-connect    | STARTING TidalConnect services, version: 1.1.3
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.front
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround21
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround40
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround41
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround50
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround51
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.surround71
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.hdmi
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.modem
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
tidal-connect    | ALSA lib pcm.c:2495:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.phoneline
tidal-connect    | Cannot connect to server socket err = No such file or directory
tidal-connect    | Cannot connect to server request channel
tidal-connect    | jack server is not running or cannot be started
tidal-connect    | JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
tidal-connect    | JackShmReadWritePtr::~JackShmReadWritePtr - Init not done for -1, skipping unlock
tidal-connect    | STARTED TidalConnect services.
tidal-connect    | [2024-05-20 20:19:21.676] [tisoc] [warning] [PlaybackControllerImpl.cpp:472] Illegal state:1
tidal-connect    | [2024-05-20 20:19:22.367] [tisoc] [warning] [logger.cpp:22] [audio_worker.cpp:321] Attempting to initialize a decoder without initial data!
andy@moode:~ $ cat /proc/asound/cards
 0 [sndrpihifiberry]: RPi-WM8804 - snd_rpi_hifiberry_digi
                      snd_rpi_hifiberry_digi
andy@moode:~ $ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
iec958
    IEC958 (S/PDIF) Digital Audio Output
_audioout
_audioout__
alsaequal
plug_alsaequal
btstream
camilladsp
crossfeed
plug_bs2b
eqfa12p
plug_eqfa12p
invpolarity
trx_send
hw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_digi, HifiBerry Digi HiFi wm8804-spdif-0
    Direct hardware device without any conversions
plughw:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_digi, HifiBerry Digi HiFi wm8804-spdif-0
    Hardware device with all software conversions
default:CARD=sndrpihifiberry
    snd_rpi_hifiberry_digi, HifiBerry Digi HiFi wm8804-spdif-0
    Default Audio Device
sysdefault:CARD=sndrpihifiberry
    snd_rpi_hifiberry_digi, HifiBerry Digi HiFi wm8804-spdif-0
    Default Audio Device
iec958:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_digi, HifiBerry Digi HiFi wm8804-spdif-0
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=sndrpihifiberry,DEV=0
    snd_rpi_hifiberry_digi, HifiBerry Digi HiFi wm8804-spdif-0
    Direct sample mixing device
GioF71 commented 1 month ago

Ok everything looks good. Can moode play hires local files (24/96, 24/192)?

Andy-Voigt commented 1 month ago

Moode resample everything. I have put 24/192 to the SoX resample and no audio anymore. Looks like the audio hat can not play such high bit rates :( .

Is it possible to resample the audio?

edit The webseite of the hifiberry says: It supports sample rates up to 192kHz/24bit.

andy@moode:~ $ bash <(wget -q -O - "https://gitlab.com/sonida/alsa-capabilities/-/raw/master/alsa-capabilities") -s
1: `HifiBerry Digi HiFi wm8804-spdif-0' Digital non-UAC audio output on device snd_rpi_hifiberry_digi
    -hardware address:               hw:0,0  (or hw:sndrpihifiberry,0)
    -sample rates per format:        S16_LE: 384000, 352800, 192000, 176400, 96000, 88200, 48000, 44100
                                     S24_LE: 384000, 352800, 192000, 176400, 96000, 88200, 48000, 44100
    -usb audio class:                (n/a)
    -streamfile:                     (n/a)
    -character device:               /dev/snd/pcmC0D0p
    -monitor file:                   /proc/asound/card0/pcm0p/sub0/hw_params

The optical cable goes into a JBL Cinebase. Is it possible that this device cannot handle such high bit-rates?

GioF71 commented 1 month ago

The hifiberry actually should handle those bitrates, maybe the limitation is in the pi2 being underpowered. So you confirm it plays correctly when using "high" instead of hires/flac?

Andy-Voigt commented 1 month ago

Yes "high" plays crrectly. Also aplay dosent play WAV files with 24/192. While the system is in idle.

Is it possible to resample the Bitrate?

GioF71 commented 1 month ago

Yes "high" plays crrectly. Also aplay dosent play WAV files with 24/192. While the system is in idle.

Is it possible to resample the Bitrate?

Actually yes, you can force the samplerate in your asound.conf, but that would mean that the resampling will happen in alsa. If you set "high" in Tidal instead, you will receive exactly what will be played, and no resampling should be happening. That said, if you want to try a tweaked asound.conf, I might try to prepare it for you.

GioF71 commented 1 month ago

The optical cable goes into a JBL Cinebase. Is it possible that this device cannot handle such high bit-rates?

Yes most likely. Try playing hires files while monitoring the audio card with:

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

If that output reports the expected sample rate, the problem might be with the downstream device.

Andy-Voigt commented 1 month ago

I have set the sample rate to 44100 now mqa works. This ticket can be closed. I think the downstream device (JBL Cinebase) can't handle higher bitrates.

GioF71 commented 1 month ago

Yes, I downloaded some product documentation files and they never mention sampling rates, so I think it's safe to assume it supports up to 44.1/48kHz

GioF71 commented 1 month ago

Hello @Andy-Voigt, can we close this? Thank you.

Andy-Voigt commented 1 month ago

Yes. Thank you.

GioF71 commented 1 month ago

Ok closing! Please, star the repo if you like the work. Cheers!