I would like to explain my project for connect my Android box Tanix TX2 based on chip RK3229 with an amplifier DAC Sabaj A4 trough an optic cable.
The goal is use the Tanix TX2 like a server MPD for playing music in lossless Hi Res Audio.
the technical specifications of the audio part of the RK3229 chip are:
- I2S0/I2S1 with 8ch: supports up to 8 channels (8xTX or 8xRX). Audio resolution from 16bits to 32bits. Sample rate up to 192KHz
- I2S2/PCM with 2ch: Up to 2 channels (2xTX and 2xRX). Audio resolution from 16bits to 32bits. Sample rate up to 192KHz
- SPDIF: Support two 16-bit audio data store together in one 32-bit wide location.
- Audio Codec: 24bit DAC. Support Line-out. Support Mono, Stereo, 5.1 HiFi channel performance. Sampling rate of 8kHz/12kHz/16kHz/24kHz/32kHz/44.1KHz/48KHz/96KHz
Following this guide [unoffical] LE-9.2/9.80-Images for RK3229/RK3228
I wrote the LibreELEC-RK322x.arm-9.2-devel-20200427220638-b7186bc-rk3229-tx2 image to my SD card.
I inserted the SD card into the TX2, hold down the reset button and turned the box on.
Through the KODI GUI I installed the MPD plugin and activated SSH.
Then I disabled KODI to auto start
The configuration of Alsa and MPD started, based on the many guides on Bitperfect and various configurations.
identified the optical output on the sound card
LibreELEC:~ # aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ROCKCHIPRK3229 [ROCKCHIP,RK3229], device 0: 100b0000.i2s1-rk3228-hifi rk3228-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: HDMI [HDMI], device 0: 100c0000.i2s0-i2s-hifi i2s-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
card 2: ROCKCHIPSPDIF [ROCKCHIP,SPDIF], device 0: 100d0000.spdif-dit-hifi dit-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
Display More
Configured like default
Configured the MPD server
LibreELEC:~ # more .kodi/userdata/addon_data/service.multimedia.mpd/config/mpd.conf
# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.
# An example of an ALSA output:
#
audio_output {
type "alsa"
name "ALSA Device"
device "hw:2,0" # optional
#### format "44100:16:2" # optional
mixer_type "disable" # optional
#### mixer_device "default" # optional
#### mixer_control "PCM" # optional
#### mixer_index "0" # optional
}
audio_output {
type "alsa"
name "ALSA 44-16-2"
device "hw:2,0" # optional
auto_resample "yes"
format "44100:16:2" # optional
mixer_type "disable" # optional
#### mixer_device "default" # optional
#### mixer_control "PCM" # optional
#### mixer_index "0" # optional
}
audio_output {
type "alsa"
name "ALSA 44-24-2"
device "hw:2,0" # optional
auto_resample "yes"
format "44100:24:2" # optional
mixer_type "disable" # optional
#### mixer_device "default" # optional
#### mixer_control "PCM" # optional
#### mixer_index "0" # optional
}
audio_output {
type "alsa"
name "ALSA 96-24-2"
device "hw:2,0" # optional
auto_resample "yes"
format "96000:24:2" # optional
mixer_type "disable" # optional
#### mixer_device "default" # optional
#### mixer_control "PCM" # optional
#### mixer_index "0" # optional
}
audio_output {
type "alsa"
name "ALSA 192-32-2"
device "hw:2,0" # optional
auto_resample "yes"
format "192000:32:2"
mixer_type "disable" # optional
priority "FIFO:48"
# period_time "8192"
# buffer_time "131072"
#### mixer_device "default" # optional
#### mixer_control "PCM" # optional
#### mixer_index "0" # optional
}
samplerate_converter "soxr very high"
Display More
With the current configuration MPD, automatically, if necessary with respect to the sampling of digital files, does UPSCALING with respect to the required output sampling (I created several outputs and I can change it).
The configuration that made me suffer the most was lowering the CPU usage since UPSCALING with the default 96KHz 24bit 2ch converter was going over 100%.
So I saw that everyone suggested using SOXR. I discovered that Kodi on LibreELEC had already been compiled with SOXR and it was enough to insert the correct string in the MPD.conf file.
Now with the SOXR converter the 192KHz 32bit 2ch playback does not exceed 30% resources.
LibreELEC:~ # more .kodi/userdata/addon_data/service.multimedia.mpd/log/mpd.log
Mar 31 10:36 : playlist: queue song 1:"VERBATIM HD/HDEND - Audiophile Air1/02 Allan Taylor – Wheel of Fortune.flac"
Mar 31 10:36 : decoder_thread: probing plugin flac
Mar 31 10:36 : decoder: audio_format=44100:16:2, seekable=true
Mar 31 10:36 : client: [10] process command "repeat 0"
Mar 31 10:36 : client: [10] command returned 0
Mar 31 10:36 : alsa_output: opened hw:2,0 type=HW
Mar 31 10:36 : alsa_output: buffer: size=64..65536 time=333..341334
Mar 31 10:36 : alsa_output: period: size=32..32768 time=166..170667
Mar 31 10:36 : alsa_output: default period_time = buffer_time/4 = 341333/4 = 85333
Mar 31 10:36 : alsa_output: format=S24_LE (Signed 24 bit Little Endian)
Mar 31 10:36 : alsa_output: buffer_size=65536 period_size=16384
Mar 31 10:36 : output: opened "ALSA 192-32-2" (alsa) audio_format=192000:24:2
Mar 31 10:36 : soxr: soxr engine 'cr64'
Mar 31 10:36 : soxr: samplerate conversion ratio to 4.35
Mar 31 10:36 : output: converting in=44100:16:2 -> f=44100:16:2 -> out=192000:24:2
Display More
The potential of this configuration is to be able to put my Hi Res music on an HDD and to be able to control the playback from my mobile phone connected to the same Wi-Fi network. So the source is not the mobile phone, but it only tells the MPD server which track to play and which audio output to use.
I use the M.A.L.P. App on my mobile phone to do this.
IMHO the result is very good i can play my music at 192Khz 32bit
Many thanks to ilmich for the support