An Alternative to Raspberry Pi for LMS
Recently I came across this post in the Slimdevices forums about a cheap little server box called the Inovato Quadra.
The website describes this as a small ARM computer built in China for the TV market. Inovato buys these in bulk and flashes them with a customized version of Armbian, a Debian Linux derivative. There is a lightweight desktop built-in (via a monitor connected with HDMI) but there is a warning that using this may cause the chip to overheat, so I chose to use it in a headless mode.
Inovato's goal is to make these available to schools and hobbyists at a very low cost as a way of learning how to make IOT devices running Linux. The board seems on par with a Raspberry Pi 3B+ in terms of performance but does not provide GPIO connections. They sell for $30 plus postage ($10) and come in a case and wall wart supply. Since Pis are scarce as of this writing (late 2022) and are being sold at scalper prices, I decided to try one of these out. It proved to work very well - I plugged it into a Topping D10s USB DAC connected to a pair of Edifier powered speakers and was very pleased with the sound. The Quadra seems capable of supplying sufficient power to the D10s via either USB port. The CPU utilization while playing music was very low, around 3%, so no worries there.
I am not sure if the latest version LMS has had a significant performance boost, but I was amazed that the Quadra was able to do a quick scan of my library of ~300 albums (mostly FLAC encoded) in under a minute. Not bad at all.
This box does have limitations, which Inovato documents on their website. For one, the internal WiFi is slow and due to the fact that their distro uses NetworkManager, the wifi chip gets assigned a random MAC address on each boot, causing routers to assign a new IP address every time. Also, there seems to be no built-in Bluetooth support. Inovato solves these issues by offering an external WiFi/Bluetooth combo dongle, but this seems pretty inelegant.
I also found a similar TV box with the generic designation of "T95" on Amazon for $29 (plus a $2.00 off coupon). The box comes with Android 9.0 installed. I ordered one and will try flashing it with the Quadra image (which Inovato makes freely available). This box comes with a remote and has TOSlink output in addition to HDMI and 2xUSB, so it will be interesting to see how it works out. If the TOSlink output proves satisfactory for audio, this would be a quick and dirty way to get a multi-room player setup running with powered speakers similar to the Edifiers (which have TOSlink input). See the section lower on this page for T95 experiments.
See the procedure below that I used for the Quadra. Some of this could probably be streamlined and maybe automated as I learn more. I will also figure out how to get WiFi configured at some point.
Note: These instructions are for a "headless" installation. They do not include WIFI setup and assume you can connect a Quadra directly to a router.
Connect the Quadra to your router with an Ethernet cable. Plug the Quadra power adapter in and wait for the blue light. Check the router to see the DHCP address that was assigned. Make this a reserved address in the router's IP table.
Connect to the Quadra via SSH at the assigned IP address from a computer using a terminal emulator. This will ensure connectivity over your local LAN. The initial password is "1n0v@t0". Once logged in, change the password to something better, using the passwd command.
Setting up Squeezlite
Install Squeezelite:
quadra@inovato:~$ sudo apt install squeezelite
The Squeezelite install should complete without errors.
Setting up a USB DAC
The next step is to configure Squeezelite to use an external USB DAC. The default for the Quadra is to use HDMI, since it is a television accessory. You can use the HDMI audio with a splitter, but better sound will be obtained with a decent USB DAC.
Plug in the DAC to the rear USB port and run the following command:
$ /usr/bin/squeezelite -l
This should result in an output resembling the following:
Output devices:
null - Discard all samples (playback) or generate zero samples (capture)
default - Playback/recording through the PulseAudio sound server
lavrate - Rate Converter Plugin Using Libav/FFmpeg Library
samplerate - Rate Converter Plugin Using Samplerate Library
speexrate - Rate Converter Plugin Using Speex Resampler
jack - JACK Audio Connection Kit
oss - Open Sound System
pulse - PulseAudio Sound Server
upmix - Plugin for channel upmix (4,6,8)
vdownmix - Plugin for channel downmix (stereo) with a simple spacialization
hw:CARD=sun9ihdmi,DEV=0 - sun9i-hdmi, SUN9I-HDMI PCM i2s-hifi-0 - Direct hardware device without any conversions
plughw:CARD=sun9ihdmi,DEV=0 - sun9i-hdmi, SUN9I-HDMI PCM i2s-hifi-0 - Hardware device with all software conversions
sysdefault:CARD=sun9ihdmi - sun9i-hdmi, SUN9I-HDMI PCM i2s-hifi-0 - Default Audio Device
dmix:CARD=sun9ihdmi,DEV=0 - sun9i-hdmi, SUN9I-HDMI PCM i2s-hifi-0 - Direct sample mixing device
usbstream:CARD=sun9ihdmi - sun9i-hdmi - USB Stream Output
hw:CARD=D10s,DEV=0 - D10s, USB Audio - Direct hardware device without any conversions
plughw:CARD=D10s,DEV=0 - D10s, USB Audio - Hardware device with all software conversions
sysdefault:CARD=D10s - D10s, USB Audio - Default Audio Device
front:CARD=D10s,DEV=0 - D10s, USB Audio - Front output / input
surround21:CARD=D10s,DEV=0 - D10s, USB Audio - 2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=D10s,DEV=0 - D10s, USB Audio - 4.0 Surround output to Front and Rear speakers
surround41:CARD=D10s,DEV=0 - D10s, USB Audio - 4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=D10s,DEV=0 - D10s, USB Audio - 5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=D10s,DEV=0 - D10s, USB Audio - 5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=D10s,DEV=0 - D10s, USB Audio - 7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=D10s,DEV=0 - D10s, USB Audio - IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=D10s,DEV=0 - D10s, USB Audio - Direct sample mixing device
usbstream:CARD=D10s - D10s - USB Stream Output
In this example, the line of interest is:
"hw:CARD=D10s, DEV=0 - D10s, USB Audio - Direct hardware device without any conversions".
Your USB sound device will be different unless you are using the same DAC.
Edit the Squeezelite default config file:
sudo nano /etc/default/squeezelite
Add this line to the file (adjusting for your particular device):
SL_SOUNDCARD="hw:CARD=D10s,DEV=0"
Save the file, exit, and reboot the Quadra. At this point, the player software should function. If you have an external LMS server on your network, the player should automatically be visible to the server. If you have not yet set up an LMS server and want to install it on the same Quadra (or a separate Quadra), follow the steps in the next section.
Setting up Logitech Media Server (headless)
In preparation for Logitech Media Server installation, populate a USB flash drive with music library files on a computer. The flash drive should be formatted with FAT32. Insert the drive into a USB slot on the Quadra. Connect the Quadra to an ethernet router or hub - these instructions do not cover getting WiFi to work, although that is certainly possible either through the Quatra desktop GUI (with a monitor and keyboard connected) or configuring the WiFi supplicant files via SSH.
Reboot the Quadra using:
quadra@inovato:~$ sudo reboot
Once the reboot is finished, login again and find the UUID of the flash drive:
quadra@inovato:~$ sudo blkid
The output will resemble:
/dev/mmcblk2p1: UUID="0d670df7-8023-43f0-b38f-454f1441f3f7" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="a65f4efe-01"
/dev/zram0: UUID="415a7703-41e9-4fcb-b290-dba3228e8ed8" TYPE="swap"
/dev/zram1: LABEL="log2ram" UUID="a24e5192-ec3c-42d0-95eb-34ef5ff33622" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda1: LABEL_FATBOOT="EFI" LABEL="EFI" UUID="67E3-17ED" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="e6d77340-19cb-4dc9-9635-611dbf500733"
/dev/sda2: LABEL_FATBOOT="CRUISER" LABEL="CRUISER" UUID="8A5F-1220" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="a68fd920-adce-47ba-8124-cac7b996c448"
In this example, the flash drive is "/dev/sda2". The label is "CRUISER" and the UUID is "8A5F-1220"
Make an entry for sda2 (or whatever your drive ID happens to be) in the /mnt folder:
quadra@inovato:~$ sudo mkdir /mnt/sda2
Then edit the fstab file :
sudo nano /etc/fstab
Add the following as the last line in the file (using your unique UUID and drive name) - be sure to use tabs, not spaces:
UUID=8A5F-1220 /mnt/sda2 vfat defaults,auto,users,rw,nofail,noatime 0 0
Save the file and reboot.
Install Logitech Media Server. Find the latest deb ARM install package here:
https://downloads.slimdevices.com/nightly/?ver=8.4 and copy the link.
Download the ARM deb file using wget and by pasting the link (this is an example - the actual file name may be different):
quadra@inovato:~$ sudo wget https://downloads.slimdevices.com/nightly/8.3/lms/1fc6a152c41af651d592bca6d553f545217047fd/logitechmediaserver_8.3.1~1669673720_arm.deb
After the download messages indicate success, check that the file is present in your home directory:
quadra@inovato:~$ ls
Result should be something like:
Desktop Documents Downloads logitechmediaserver_8.4.0~1669875672_arm.deb Music pi-apps Pictures Public Templates Videos
Unpack and install the package - copy and paste the exact file name shown in the directory:
quadra@inovato:~$ sudo dpkg -i logitechmediaserver_8.3.1~1669673720_arm.deb
The package will install with errors because perl is not installed yet. Install perl as follows:
quadra@inovato:~$ sudo apt install libcrypt-openssl-rsa-perl
This should run with a suggestion to fix the install, which is required:
quadra@inovato:~$ sudo apt --fix-broken install
Answer "Y" to the question about continuation. Installation should complete with the fixes applied.
At this point, Logitech Media Server (LMS) should be running. Point a browser to the IP address or network name of the Quadra combined with port number :9000. The LMS webpage should display.
LMS will be in setup mode. Skip the invitation to log into mysqueezebox.com. LMS must then be pointed to the mount point for the flash drive holding the music library. In the folder list, select /mnt/sda2 (or other name specific to your case) for both the music and the playlist locations and click finish.
Check that LMS "sees" a running Squeezelite player - look at the upper right on the LMS web page - the default name will be "Inovato" if you installed Squeezlite described in the other post.
Enter LMS settings. Initiate a scan of the library. Once complete, check that LMS sees all the content on the flash drive (albums, artists, etc.).
At this point, the combined Squeezelite/LMS package should function correctly. The LMS server and player(s) can be controlled by external devices running software such as iPeng or a browser pointed to the Quadra. It also works well with the "Material Skin" plugin (which must be selected in the plugin tab in LMS settings).
One potential issue for removable USB drives is that they don't auto-mount. This would make it difficult to build a music server for other people to use or to install new USB drives with music libraries. Various web sources indicate that the most up-to-date solution for Debian is to use udisks2:
apt install udisks2
I was not sure this solved the issue, so I also installed autofs and usbmount, which together seemed to solve the mount problem:
sudo apt-get install usbmount
sudo apt install autofs
T95 Max Experiments
I also got a "T95 Max" TV box from Amazon. It is pretty generic with no links to support or downloads for re-flashing. But it was only $27 shipped so an inexpensive sandbox. This is just one of dozens of Chinese TV boxes, most of which run Android OS and have an ARM chip inside. The user guide is written in broken English and is not of much use. The molded plastic case is rather nicely done and has a quality feel. This box has some advantages over the Inovato Quadra: it comes with an IR remote and has TOSlink output.
These are rather curious devices. If you own a smart TV or an older dumb TV and added an Amazon Fire TV or a Roku device, these are really superfluous. I think the numerous Chinese shops making these (and they seem to be near clones of each other) will soon cease production for that reason. Oh well - if you can find other uses like I am trying here, then they are a bargain.
I did find this link which may or may not work for re-flashing this particular box back to its factory Android OS: https://chinagadgetsreviews.com/download-android-pie-9-stock-firmware-for-sunvell-t95-max-tv-box.html
The Armbian folks have pretty much given up trying to support all the variations of these devices, so people who want to try it are on their own.
After verifying the box works with a TV connected via HDMI, the next step was to investigate whether the box could boot the Inovato distribution. According to some posts in their forum, if an HDMI monitor is connected, the box will attempt to boot from the SD card slot. If no monitor is connected, it will attempt to flash internal memory from the card (assuming it has an image). Also in that post is a suggestion to override this behavior by editing a file to always boot from SD card regardless of the presence of a monitor.
It turns out that this particular box will only boot from the SD card (no monitor attached) and not perform a flash operation with the Inovato firmware on an SD card. The manual (such as it is) that came with the T95 says to use the toothpick method to flash.
This link on the Inovato site has some details for getting the Quadra firmware flashed on T95 devices: https://www.inovato.com/article/install
Other posts regarding generic boxes suggest the "toothpick" multiboot method: inside the AV port there is a switch that can be depressed with a toothpick or similar tool. The switch must be held down while applying power, at which time it will try to flash from the SD card.
Another possibility is to install a version of Armbian. This link has a guide to installing: https://docs.armbian.com/User-Guide_Getting-Started/#legacy-or-current
They recommend that if the SD card has been used previously, a complete factory format should be done using this tool: https://www.sdcard.org/downloads/formatter/ . This is the "official" formatter recommended by SDcard.org. An overwrite format on a 128GB card took about 12 minutes on my Macbook Pro.
The Armbian downloads are here: https://www.armbian.com/uefi-arm64/. You can choose between a CLI or desktop versions (CLI is much smaller).
So far, I have not been successful in flashing the internal memory, but it will boot the Inovato code OK from SD card. I was able to install Squeezelite and get it to output to a USB DAC. However, I had trouble getting the TOSlink output to function correctly. I tested it with the optical input on my Edifier speakers, but got a weird half-speed playback effect, indicating a lack of synchronization or the wrong sample rate. More troubleshooting will be required.
Another low-impact, low cost way of connecting to an external sound system would be to use Bluetooth, which I may try soon.
I have tried an Armbian distro variant created by a coder named "awawa". His repo is here: https://github.com/awawa-dev/build and he has a pre-built image available. This boots and runs OK from SD and seems tailored to this specific T95 box. He claims to have fixed the flashing issue, but I have not had time to check it out.