Archphile - An Archlinux Based Audiophile Distribution for Raspberry Pi and Udoo Quad

Just a small update on what I am currently working on. For this example I will use my latest odroid c2 configuration.

As you may have noticed, until today you could find two options in archphile-optimize script:
Code:
# IRQ affinity optimization - Do not apply it if you are using Raspberry Pi 2 !!!
#/usr/bin/irq-archphile

# set affinity of MPD in one core - choose values from 0-3
#taskset -c -p 2 $(pidof mpd)

The first command, if enabled, calls the following script:

Code:
#!/bin/bash
# Cores 1 2 3 4 have to be put as 1 2 4 8

# USB bus
echo "8" > /proc/irq/62/smp_affinity
echo "8" > /proc/irq/63/smp_affinity

# Ethernet
echo "2" > /proc/irq/40/smp_affinity

This means that all interrupts that have to do with the usb bus go to the second core, while all ethernet interrupts go to the forth.

The second command, sets mpd to be run only on third core.


What I did today and confirmed that it works is the following:

1. I set a kernel parameter so that nothing is used in third (using 0,1,2,3 is core number 2) core, apart from what is set via taskset. The parameter is:

Code:
isolcpus=2

In addition I expanded the taskset section. It now includes:

Code:
#set various processes to be run on specific cores 
taskset -c -p 2 $(pidof mpd)
taskset -c -p 0 $(pidof ympd)
taskset -c -p 0 $(pidof rngd)
taskset -c -p 0 $(pidof systemd-journald)
taskset -c -p 0 $(pidof systemd-logind)
taskset -c -p 0 $(pidof systemd-udevd)
taskset -c -p 0 $(pidof dbus-daemon)
taskset -c -p 0 $(pidof init)
taskset -c -p 0 $(pidof lircd)

This means that almost all processes go to the first core, while the third is only used by MPD. The list of the processes that will be redirected is not yet completed btw.

So the result is:

- Core 1 handles most of the processes and remaining interrupts (don't worry, archphile is really lightweight and the load is almost zero even in this core)
- Core 2 is dedicated to ethernet interrupts
- Core 3 is dedicated to MPD
- Core 4 is dedicated to usb bus interrupts



I am almost sure that there will be no change in sound, but I believe that this is a more sophisticated configuration.


Any comments on the above approach or any additional tips are highly appreciated!



P.s. unfortunately the IRQ affinity part cannot be applied using the RPI.
 
Last edited:
I applied all of the above and took some measurements with monitorix on Odroid C2.

My configuration was the following:

- All standard Archphile processes open (everything that is usually open by default in Archphile images)
- Music was server using samba
- All the files were flac 16/44.1
- The only usb device attached was an Aune S16


1. Interrupts Summary (Number 63, the green one shows the USB interrupts)

An externally hosted image should be here but it was not working when we last tested it.



2. Load Summary

An externally hosted image should be here but it was not working when we last tested it.



3. Analysis of the first core that handles most of the processes and some interrupts

An externally hosted image should be here but it was not working when we last tested it.



4. Analysis of the second core that handles ethernet interrupts

An externally hosted image should be here but it was not working when we last tested it.



5. Analysis of the third core that is dedicated to MPD

An externally hosted image should be here but it was not working when we last tested it.



6. Αnalysis of the forth core that handles USB interrupts

An externally hosted image should be here but it was not working when we last tested it.



7. Summary of kernel use

An externally hosted image should be here but it was not working when we last tested it.



8. Network traffic during the time I took the above measurements

An externally hosted image should be here but it was not working when we last tested it.
 
Last edited:
Many of you may not be aware of it, but Archphile Playground repository includes squeezelite and logitechmediaserver packages for a long time.

Although I never use the above combo, I have decided to keep maintaining these packages, so that anyone that wants to experiment with them will be able to install them.

I just updated the PGKBUILD for the next package builds and I would like to get some feedback from squeezelite users, regarding the default options I should use.

Squeezelite is initiated with a systemd service file that includes the following:

Code:
ExecStart=/usr/bin/squeezelite\
 $OPTIONS\
 $NAME $MAC $PRIORITY\
 $MAX_RATE $AUDIO_DEV\
 $BUFFER $CODEC $ALSA_PARAMS $VOLUME\
 $LOG_FILE $LOG_LEVEL\
 $UPSAMPLE $DOP $VISULIZER $SERVER_IP

All the above options can be configured using a separate file, that currently includes:

Code:
# default squeezelite configuration
SERVER_IP="localhost"
NAME="Archphile"
LOG_FILE="-f /var/log/squeezelite.log"

The server ip, points to localhost by default so that the user that wants to test it can use squeezelite and logitechmediaserver on the same machine. Of course if you have a dedicated LMS box, you can put it's ip there.

Do you have any suggestion for the rest options so that I will use them as defaults?

Many thanks in advance,

Michael

P.s. The packages above will not be installed/enabled by default, but the procedure to make Archphile a squeezelite box will be very easy with a simple command.
 
Lately I have started experimenting with spotify:

https://github.com/archphile/playground/tree/master/spotify

The solution above currently works only for arm7 architecture. The result is a spotify client that can be controlled from official spotify applications.

I did some tets and although it works without problems (with spotify premium), my dac is locket at 48khz.

I am thinking of offering these packages along with a quick guide for anyone that wants to experiment, but I am not sure if the sampling rate of 48khz is correct or if there's a resampling stage I am currently missing.

Do you have any opinion on this?
 
After some extensive listening tests using the mentioned configuration, I noticed some glitches in sound.

One interesting "issue", was that there were times that I was sshing from my desktop PC and I could hear a noise from my hifi when I pressed the enter button :D


I tried to find a more conservative configuration, and as a result my current settings include:

- irq affinity settings as mentioned before
- MPD stays with a dedicated and isolated CPU core
- The only additional process set to first core is ympd

It seems that "taskset" almost everything was not a very good idea :D
 
Hi all,

I am opening this thread in order to discuss about DSD music reproduction using Archphile/MPD.

Currently the offered packages are:

- mpd-archphile (the default package) - support of dsf/dff files with DoP
- mpd-archphile-minimal - support of dsf/dff files with DoP
- mpd-archphile-native-dsd - patched MPD fork that offers native dsd for specific dacs
- mpd-archphile-sacd - MPD fork that offers SACD ISO reproduction with DoP

On this topic we will focus on Archphile usage with the first two packages.

Many of you may have noticed clicks when listening to DSD files via DoP. This is not a bug of MPD and it mainly has to do with the nature of DSD. There are media players (like Jriver for example) that have already applied silence patterns in order to handle this issue.

DSD (mainly native) support in Linux is a complexed situation that has to do with Linux/Alsa/MPD versions.

I was able to perform some tests with my equipment:

- Diy 9018k2m + DIYIHK XMOS usb receiver
- Aune S16 (XMOS based)
- Odroid C2 with it's latest kernel 3.14 (it includes dsd format patches from later kernels)
- MPD 0.19.19 (a pattern silence fix has already been applied in earlier version)
- DSD 64 (dsf) files


- Aune S16 dac

Code:
Card 1, ID `DAC', name `S16 USB DAC'
  Device 0, ID `USB Audio', name `USB Audio', 1 subdevices (1 available)
    2 channels, sampling rate 44100..384000 Hz
    Sample formats: S32_LE

Code:
[root@archphile ~]# lsusb -d 20b1:
Bus 001 Device 006: ID 20b1:3023 XMOS Ltd

Code:
access: RW_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 176400 (176400/1)
period_size: 22050
buffer_size: 88200

I listened to dsd 64 files and the situation was as it always was, with clicks when i play/pause or skip to another song.


- DIY 9018K2m + DIYIHK USB

Code:
Card 1, ID `D20', name `DIYINHK USB Audio 2.0'
  Device 0, ID `USB Audio', name `USB Audio', 1 subdevices (1 available)
    2 channels, sampling rate 44100..384000 Hz
    Sample formats: S16_LE, S32_LE, SPECIAL, DSD_U32_BE


Code:
access: RW_INTERLEAVED
format: S32_LE
subformat: STD
channels: 2
rate: 176400 (176400/1)
period_size: 22050
buffer_size: 88200

I listened to dsd 64 files and without any click. In the past I had the same problem as with the AUNE S16. This time it was 100% ok.

I noticed that this receiver has enabled support for DSD_U32_BE, so I decided to test with the native-dsd version of MPD (Please remember it's a fork!):

Code:
access: RW_INTERLEAVED
format: DSD_U32_BE
subformat: STD
channels: 2
rate: 88200 (88200/1)
period_size: 11025
buffer_size: 44100

As you can see, I was able to listen to dsd 64 files in native mode. However clicks were present again during pause/play, skip etc.!

BTW, AUNE should have DSD_U32_BE format support based on the following code:

https://github.com/hardkernel/linux/blob/odroidc2-3.14.y/sound/usb/quirks.c

Although the code mentions Aune X1S, based on the lsusb output above, they have the same type of USB receiver and in theory it DSD_U32_BE should be present. Unfortunately it wasn't.



What I did was the following:

1. I gave feedback to musicpd bugtracker with most of the above information (apart from the native-dsd fork stuff):

https://bugs.musicpd.org/view.php?id=4320

2. I opened an issue on Github that has to do with the AUNE S16:

https://github.com/lintweaker/xmos-native-dsd/issues/23


Conclusion:

I have to admit that I am really confused with DSD and all the click issues. I can't understand why one dac is ok and the other is not. In addition I hope to get an explanation why the Aune S16 does not have support of the DSD_U32_BE format.

How is DSD reproduction using DoP for you until today? Do you have any clicks? What Dac do you mainly use with DSD files?

Regards,

Michael
 
Last edited:
Hi guys!

Does anyone know how to get I2S to work with the soekris 1021 on odroid C2?

For Archphile with C1+ there was a workaround in /boot/boot.ini- but that part changed in C2- Version.

Would be great if someone has experience with this and would share IT.

Greetingz, Robert
 
Hi guys, did anyone tried(succeeded) to install librespot on archphile? I am knocking my head for half of the day here. Copied all files from archphile git, then, ofcourse, as a "root" I wasn't able to install anything so created new user, and launched the script, but at the end got "git: error while loading shared libraries: libcrypto.so.1.1"

tried also to install from librespot from here "https://github.com/herrernst/librespot/releases" and got "Segmentation fault (core dumped)" . If added as service and tried connect - initial connection was good, but soon enough it disconnect and after kaput.

#ToughLifeWithArchlinux
 
In order to respect dependencies you should do the following:

Lets assume that you want to build it for the latest RPI2 image. If you have a look here:

https://sourceforge.net/projects/archphile/files/rpi2/

it was released on 29/02/2016.

You need to use the ArchlinuxARM rollback machine and install packages from that period, because if you install the latest, you will break dependencies for the existing packages I have already built and included.

The following line has to be put in the beginning of:

/etc/pacman.d/mirrorlist

Code:
Server = http://tardis.tiny-vps.com/aarm/repos/2016/02/29/$repo/os/$arch


This means that you will be installing packages from the days I created the image.

Now it's time to install packages needed for compilation of Archlinux software:

Code:
pacman -Sy base-devel unzip

After that, you have to create a new user, lets name him archie:

Code:
useradd -m -G users -s /bin/bash archie


and create a password for him

Code:
passwd archie

edit /etc/sudoers and put this user here with the following line:

Code:
archie ALL=(ALL) ALL


Now login as archie and goto to his home:

Code:
su archie
cd /home/archie

Download archphile needed stuff in order to build librespot and unzip them:

Code:
wget [url]https://github.com/archphile/playground/archive/master.zip[/url]
unzip master.zip
cd playground-master/librespot-archphile/

The wget command is messed up here with the dots inserted in the link. Hover your mouse on the link and copy the full web link as is shown on your bottom of your browser.

Now it's time to build the package:

Code:
makepkg -s

after it finishes (it takes a lot of time) you will have a package that you can install with:

Code:
sudo pacman -U blabla

now press

Code:
exit

to become root again.

After the installation, you will need to edit the configuration located at /etc/librespot.conf

and as a last step you will have to enable and start librespot service:

Code:
systemctl enable librespot
systemctl start librespot


P.s Your installation as I understand is already messed up with dependency errors, so a good idea would be to try the above with a new installation.
P.s.2 If you don't want to use the rollback machine you can update everything and then rebuild all my packages, but that's not a good idea because a lot of things have changed since the last images I uploaded.
P.s.3 In order to take full advantage of all the cpu cores, you can edit /etc/makepkg.conf and set MAKEFLAGS="-j4" for a 4 core board.
 
Last edited: