soundcheck's sKit toolbox

 (Latest update: Nov-19-2021)

I was thinking of how to get the whole Audio Streaming Series (using a RPi4 and piCorePlayer as base),  a bit more condensed and most important: easier to apply - and that, for all people.
Simply to make sure that everything ends up satisfactory for you. And it should also end up as being intended and explained. It shouldn't take the user more than an hour to get going.

After looking into it, it turned out that many of the measures I've been describing and proposing would make a nice small set of tools. (similar to my first Squeezebox Touch Toolbox project). 

Even fellow audio-enthusiasts lacking in-depth computer skills would be able to get things done that way.

And this then finally led to 

sKit
(soundcheck's tuning Kit)  

sKit provides a small set of tools to customize and enhance the piCorePlayer base OS for best possible audio performance.

For now sKit supports a streaming-client setup, just squeezelite and no LogitechMediaServer!
A combined client-server setup (standalone player) would require a different tuning profile.

All sKit tools are supporting and focussing on my highly recommended HW platform a Raspberry Pi4.  (RPi3 and related CM modules might also work - no promises made - I won't test them and I won't support them - because the RPI3 platform is IMO simply not recommend for the purpose).

The sKit toolset supports 32-bit and 64-bit pCP versions. sKit has been tested on pCP > 7.0. 

sKit currently neither supports USB boot scenarios nor netboot scenarios. (a pCP shortcoming)

All sKit tools have to be executed from a pCP linux terminal. Many of you meanwhile know the process of how to access such a terminal via ssh by now.  If you don't know how to do that, have a look at the official pCP documentation to be found over@pCP  first.  I know you - all of you -  will manage!

Once you're logged in to your RPi via ssh, you simply have to enter one of the further down listed commands to get this or that job done. A piece of cake! No hacking!

All sKit sources a stored on github. There's nothing to hide. You'll be on the safe side. You can lookup the source about what's actually done.

Before using the sKit tuning kit. Make sure you have a look at The Audio Streaming Series to have your system, prepared and properly up'n running. Not all recommended settings are covered by the tuning kit (yet). Beside that you'll get the idea what this is all about.


_____________________________________________________________________

ATTENTION:

Several fellow sKitters have been facing serious pCP repo-server download issues,
which made it impossible to build and install the sKit provided custom squeezelite binary. MeToo.

Support from the pCP team can not be expected. The clunky server performance is known for years and they won't do anything about it. 

Anyhow.

I now  (Nov-19-2021) released an update of sKit-custom-squeezelite.sh. You can load it using the sKit-manager.sh "update" function.

The new version tries everything to make sure the download is gonna be successful.
To accomplish that the updated version won't use the pCP supplied package download tool anymore - I wrote my own procedure.  

You'll see a lot more on screen while running the custom-binary build about what's going on.  I think this kind of feedback also helps you as user.

Two more hints:
  1. Try to avoid busy weekends or potentially busy repo-server hours for download
  2. Better avoid the sourceforge.com mirror - that one IMO performs extremely bad

I'd highly appreciate to let me know how it works. I'll remove the beta status as soon as I have received a couple of confirmations.

____________________________________________________________________________

 

To be prepared for sKit after a fresh pCP install, you need to have at least following bullets ticked off:

  1. increase the filesystem to at least 200MB (we need ~100MB free space for sKit)
  2. run a patch-,  minor- and  full-update
  3. enable your audio device
  4. disable RPi built-in audio
  5. disable bluetooth and HDMI - and Wifi (if you go wired - what I highly recommend!)
  6. configure the squeezelite parameters as I suggested for your audio device
  7. test your base setup incl. running some audio tracks
  8. run a backup of this configuration, you might have to restore it later on, or
    you can easily do some before/after testing.


A reminder:




Just to mention it once more, the pCP ssh-login default credentials:

user: tc
password: piCore


Sounds OK and manageable so far!?!?

Let's get sKit installed. 

Initial Installation

The next step has only to be done once. Somehow we need to initialize the toolbox by downloading the installer from github. Once that is done sKit is stored on the system and all further tasks are initiated locally on your system. You'll need an up'n running internet connection to make it all happen!

Let's get started.

Log yourself in to your RPi via ssh.

Now copy/paste below command:

wget -O- https://raw.githubusercontent.com/klslz/sKit/master/download 2>/dev/null | sh






This action will download and install the sKit-manager.sh program to a temporary directory.
Once more: This action has to be done only once!

Now you can install sKit. On the command line prompt, you simply enter the respective program name.





sKit-manager.sh


The sKit-manager will appear. After accepting the sKit T&Cs choose the "1" "install sKit". 😉






During the installation you should see this:




Once sKit is properly installed the system will reboot. You again have to ssh-login to continue the process. 

By now you'll have the system already nicely shaped! Quite some sKit measures will already be in place. 

What's left to do then!?!?  

You'd just have 

  • to install a custom squeezelite and 
  • turn off the LEDs 

After that you'll be good to go. Most other stuff is optional.

Note: The bold headings ending with .sh on this page reflect the program names (commands) for starting the sKit tools from the ssh command line interface.

Just copy/paste these strings into your ssh terminal.


Now, from time to time there'll be sKit tool updates. Use the update function to get the tools updated. 

Only the sKit tools will be updated.  Not the tuning measures!!! Therefore it can very well happen that you need to start with a fresh pCP install and a fresh install of sKit! I'll inform you about it in the respective release notes. For that you need to start the sKit-manager.sh 




If you're NOT happy with sKit or if I issue a sKit upgrade that requires a fresh sKit installation, you can get sKit removed via the sKit-manager.sh.

Removing sKit removes (from sKit 1.4 onwards) the sKit tools, configurations, the custom binary and restores the original pCP packages (extensions)!  There's shouldn't be much of a trace of sKit on your pCP installation once this step is done.





Keep in mind. The removal process works properly from sKit 1.4 onwards! 
If you still run an older sKit version please start over with a fresh pCP install.

sKit-check.sh


It's usually hard and/or annoying to keep track of all the settings, mods and tweaks on the system. 
You never really know if all the tweaks are enabled, disabled or configured correctly. 
And that's why I wrote sKit-check.sh That's actually the tool I use most.







The tool checks your installation against the recommendations made in the Audio Streaming Series.
If you see a green output, everything should be OK. 
A yellow output hints that the setting has a little space for improvement. Basically not the best of all options, still OK though. E.g. if you're on Wifi - to me it'd just be the 2nd best option after wired ethernet. 

If you'd see red, there's some action on you. Try get them all green first. It'll be a good starting point.
Once you achieved that "GREEN" state and music plays fine,  I'd suggest to run another backup of your SD card.

After that you can play around with your own custom settings. 

Below you'll find values and ranges the tool expects. These cover my most recent and preferred configurations.  

Warning: These might differ from some of the infos you find on the blog elsewhere. Be assured. This spot is the reference spot! I'll try to get the rest of the blog in sync as soon as I can.


isolcpus:            OK if CPU 3 is isolated  (Note: 3 only! it used to be 2 and 3!)
c-s output priority: OK if between 45 and 50
c-s affinity main:   OK if affinity is 1,2
c-s affinity output: OK  if "-A" squeezelite option is set
c-s ram-playback:    OK  if greater or equal than  300000 (300MB) 
c-s alsa params :    USB DACs    - OK    if 160:4::1
                     I2S DACs    - OK    if 65536:4:1

The "c-s" printouts appear as soon as you've got a custom "soundcheck" binary installed.


------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------

sKit-custom-squeezelite.sh

The sKit-custom-squeezelite.sh tool you know from The Custom Engine project.
The tool 

  • offers, 
  • builds and 
  • installs
 different 

  • customized (e.g. soundcheck's linear volume control, multiprocessor resampler (MP) ) 
  • stripped down and 
  • optimized (platform, architecture)
variants of squeezelite.

It selects the "soundcheck - minimal" binary by default. For a reason. You should try it. The 
custom binary and related settings are another key measure.

Beside that the tool automatically configures OS related settings, such as

  • system CPU isolation 
  • task affinity (assigning squeezelite to each of the isolated CPUs)



 

A whole bunch of things happen with this measure. Before you start the tool, make sure you have 100MB of free space - the tool bails out it there's not enough space. On a fresh installation it is sufficient to increase the file-system to 200MB. The 100MB consists mainly of the pCP compile environment that we store on the SD-card. The 100MB gets only temporary loaded into RAM - only during binary build time.

Note: I did run into pCP extensions download issues - driving me nuts - several times. That's the answer I received from the pCP team, pretty much confirming the shaky behavior of their download servers. A workaround is to try the mirror server to see if that works better. 


Finally.

Do not miss  the linear volume control feature (1dB/click) that comes with the my version of squeezelite! Most volume controls show rather random behaviour, all coming with different attenuation curves. My squeezelite version goes up'n down with 1dB/click. 

You have to enter "-X" for linear internal volume control or "-Y <your-mixer-control>" for external linear control in the pCP WEB-UI under squeezelite settings/various options field.
E.g.



would assign the output-thread to CPU3 (-A) and would enable the internal linear volume control.

 

sKit-led-manager.sh

This tool disables and re-enables the two RPi main LEDs (ACT and PWR) and ethernet port LEDs.

It lowers

  • RPi activity
  • power consumption
  • light pollution





Turning the LEDs OFF saves a little power and stops light pollution in the room. It's been introduced in the advanced base setup article. Just do it. ;)


sKit-tweaks

This tool is NOT supposed to be executed manually from a terminal. pCP will autostart the tool at system boot. During the sKit installation all related configurations were done already.

I am still listing it, because it applies some key measures I'd like to explain.   

This tool runs several system optimizations tasks. It's an enhancement over the Kill-The-Daemons tweaks introduced in the Advanced Base setup article. 

What it does. It

  • disables the still active idle network interface (ethernet or WLAN)
  • assigns proper squeezelite affinity settings. (workaround for pCP flaw (stat Feb-2021) )
  • kills several daemons (after 180s) (WEB interface, dhcp, ssh access)
  • ...more to come


You'll find the situation as shown below after the sKit installation . This way the tool is active and being started @ boot time.



To deactivate the tool you need to add a # in front of the sleep command, as shown below, and
press SAVE afterwards. Once saved, initiate a Reboot from the pCP Main page.

 




To simply pause the tool-launch at boot, in case you'd like to run some configurations or changes to pCP from your side, you have to insert the #, save it and reboot.

After 180s - while sKit-tweaks is activated - there'll be neither WEB-access nor ssh access. Make sure you do your changes  during that 180s grace period right after boot. 

And do not forget to re-enable the sKit-tweaks and reboot once you're done with your changes!

If you login via ssh during the 180s grace-period, the sKit-tweaks tool will automatically be stopped!
In this case you wouldn't have run the insert/remove "#" action. There wouldn't 't be a lockout anymore! 

The sKit-tweaks part IMO is one of the key tuning measures! Make sure you got it activated!

 

sKit-src-manager.sh 

The tool provides you easy access to highest quality sample-rate conversion. Keep in mind. What matters if you do digital signal processing (DSP) are the settings of the filters that are being used. squeezelite with libsoxr gives you the framework. We need to get it going.

Now. You're the driver. It's your job to get the horsepowers on the street.
To give you a headstart the sKit-src-manager.sh tool offers a selection of a few sample-rate conversion (SRC) presets that I consider worth trying.  

As outlined in the Audio Streaming Series - The converter and in the  Resampling - If you can't avoid it article from 2011, there are IMO certain good reasons to try SRC. The key reason is that your SRCed data might beat the internal DAC filters and DSP.  This could outweigh the SRC related losses - no DSP is lossless. 




As you can see above. For now I'm offering 4 presets. You should try them all to get the picture. Give each of them a little time to sink in.
My experience shows, there are DACs that show real nice performance jumps, others do not show any change and yes, there are DACs where things get worse. No promises made!

Working with DSPs and digital filters is not an exact science. Every DSP solution remains a compromise.

One more thing needs to be mentioned for now. Inside the pCP Squeezelite Settings menu, you'll find a field Max sample rate. By default, with the Max sample rate field being empty, above presets synchronously resample to the highest possible sample-rate that your DAC supports. squeezelite recognizes the maximum samplerate of your DAC. However. There are cases (my DAC) where the maximum sample rate the DAC is offering doesn't work. That's when u use the Max sample rate field.
Just go one level below you DACs max sample rate. And try that. Below the setting for my iFi DAC.


 

Typical values to try would be: 768000, 384000, 192000, 96000
The uneven values (x*44100) are automatically selected by the synchronous resampling mode!

That'll be it for the time being. I'd really like to hear some feedback on above presets.



Optional Tools

sKit-restore.sh


pCP just introduced a nice backup function. You can run a backup of the booted pCP SD-card image.
And you can store it on an external disk or on the internal ramdisk for further processing with scp.
If you followed my advise of increasing the filesystem to 200MB your image will be about 270MB in size and compressed about 200MB.

For the restore to work you'd have to remote-copy-via-ssh  (scp) your backup image to /tmp or you'd have to attach you backup media and mount it by choosing your image location/save.





Once that is done you can start sKit-restore.sh from a terminal. For a test a pCP backup could be stored on default /tmp/images, leave it there and restore it with sKit-restore.sh .




sKit-restore.sh immediately halts the system - immediately once the data are written back - trying to avoid any corruption issues.  You'd have to re-power the RPi after the restore is finished.

Running online-restores is tricky. I tried to limit the risks as much as possible. However, I can not guarantee that it works for you or in all cases. I did it several times by now and to me it seems to 
work rather stable. Otherwise I wouldn't have released the tool. As usual you run the whole thing 100% at your own risk. You better run some tests first.

Hint. How I do it: I am installing a base pCP image, do all kind of basic configurations, updates, increasing filesystem, setting up the audio device properly before installing sKit. At that point I run a backup. After that I can install sKit. If something goes wrong I just restore the backup. Not even a 5minute exercise.

Each of the actual backup and restore and scp task execution takes less then a minute in my environment. That's great. No more SD cards to carry around. ✌ 

For me as a power-user sKit-restore.sh is a highly useful feature. And it's unique to pCP. No other system I'm aware of, could run an online-restore. Great to have a fully ram-loaded system at hand.

As usual. Feedback, especially on the restore part,  is highly appreciated.

Other goodies

psp 

Introducing an advanced ps (process state) command and a new alias. The vastly stripped down default pCP "ps" Linux command (busybox) is pretty useless when it comes to looking up your process situation. 

Now. sKit installs a small package (procps-ng) that offers the full featured ps. The sKit manager installs also a very useful alias that runs ps with some useful options.

By typing psp in a terminal, you'll get the full picture, about processes, threads, priorities and affinities. This way you can easily verify if all related settings and tweaks are working.

 


What you can see here is, is that a squeezelite-custom version runs @priority 47. And just the output thread runs  @prio48. You also see that all threads except the output thread (CPU3) are attached to CPU2 or 1. That's basically how it looks if everything is properly sKit-like configured.

You can try this command once you're done with the whole setup and tweaking. 


trouble reports

If you encounter issues or if you have improvement proposals, you can either contact me via this blog
or my github presence.

  • describe your setup 
    • RPi revision and type 
    • pCP  revision and version (32 or 64bit)
  • describe your issue properly
  • what's been done - step by step
  • describe corrective measures taken 
  • add logfile (to be found under /mnt/mmcblk0p2/tce/sKit/log )
  • screenshot

The more specific you are, the easier issues can get fixed. 

No proper Info  >>  No Action on my side  >>>>  No Fix.


ideas/prospects

I've got plenty of ideas....

  • sKit evolution and maintenance  -  pretty solid efforts 
  • sKit-custom-realtime-kernel     -  that'd be a major project - and a major step up
  • sKit-advanced-tuning                -  there's still much more to gain
  • sKit-basic-settings                     - do the pCP basic configs with a tool.
  • sKit-server/standalone - combined  server and client operation
      OR even:
  • sKit-Moode - piCorePlayer is not the only system with tuning potential
  • sKit-Volumio - that applies here again


...and limited resources!!!


Wrap UP


I hope you all enjoy the sKit Toolbox and the improved audio performance it's supposed to bring to you and your beloved audio system.
All I can say from the feedback I receive sKit seems to work quite well for many folks out there.

I hope you'd agree that sKit does deliver a noticeable Audiophile VALUE to you.

And I also hope that the numerous hours that go into such are project are not wasted. It's not just the design and writing of code. It's the maintenance, documentation, support, contact and mail management and also the hardware to develop and test on. Quite an effort and quite some expenses.

And also keep in mind I do all this work just for you folks out there. I am not even using pCP myself!
 
If you want this project to continue - and I've shown earlier that there's more potential - 

supporting the project could be the ticket for even better audiophile performances. You can trust me on that one! 

Bottom line. If you want to keep the project going, you can contribute via the blog DONATION .

Enjoy.  😉

20 comments:

  1. Hi! Thanks a lot for all the work and the info! Really learning a lot! Was playing with the new skit, but after installation LMS stopped. I run from a RPi 3B+ with a Boss DAC, and have updated piCoreplayer and LMS. Any idea what I could do to have LMS back on the same card?
    Thanks again, Michael

    ReplyDelete
    Replies
    1. Thx for the feedback.

      Currently a combined LMS/squeezelite operation is not supported.
      This would require a complete different tuning profile.

      I added a note to the article.

      Delete
  2. Hi, soundcheck! Thanks for the work. There is a problem when using sKit-check.sh which shows red "please check" sign at "SL-custom-out priority", and I don't figure out what to check.
    Any help is most welcome,
    JK

    ReplyDelete
    Replies
    1. You should check what priority is configured in your squeezelite settings.
      I check against the recommendations I made in the Audio Streaming Series.
      If you run a different Priority it's fair enough.

      Delete
  3. Well done! It sounds better than ever. Any idea why sKit-check.sh tells me, hdmi is enabled and Skit disabled? hdmi power is "off" on the tweaks page and sKit-tweaks is wizhin the user commands. Is ist because i use a raspberry pi 3b+?

    ReplyDelete
  4. Dear Soundcheck, i installed one fresh piCorplayer + sKit 1.5 on Pi4 + KTB. Pi4 and KTB are powered with 2 iFi ps + extra caps. The sound is just absolutely f...ing great. I have one (very ?) good system. I just can't stop listen. One question - squeezelite is running on core 1&2, core 3 is reserved. What is running on core 3 ? Thank you so much much for your phantastic work. Tomek :)

    ReplyDelete
    Replies
    1. The squeezelite (my optimized squeezelite version!) alsa-output thread gets assigned to CPU3 exclusively. The idea is to avoid as much distraction for that key process as possible.

      Delete
  5. One question or hint about rpi 4 getting hot. Has anybody updated rpi firmware? Mine was always around 60 degree, no matter what cpu governor. So i tried updating rpi`s firmware, see raspberry pi homepage. Create a micro sd card with rpi os, place an empty file named ssh on it and you can connect your pc via putty (username pi, password raspberry). Follow the advice on "Updating and upgrading Raspberry Pi OS". Afterwards temperature was significantly lower and everything worked as before so far.
    Looking forward to next sKit version!

    ReplyDelete
    Replies
    1. The heat issue has been an early RPi4 issue. It's been fixed a long time ago. However. If you run pCP only, you're facing a lack of a firmware upgrade mechanism. The pCP team is well aware of it, I brought it up quite a while ago. They simply refused to do something about it back then. "It's not worth it" . I haven't checked recent developments though.

      Anyhow. As you say - the easiest and most reliable way is to install a RPiOS and get the latest firmware by running "rpi-eeprom" as root. Before that run an update of the OS.

      Keep in mind, being back on the pCP OS you can't change the bootloader
      configuration. For 99% of the folks out there it doesn't matter, since they run the default bootloader settings ( BIOS-like settings ) anyhow.

      All that is another why I am running RPiOS myself. RPiOS is the OS where the foundation runs its developments on. All RPI related tools and configurations are properly implemented. From that perspective no other OS beats RPiOS.

      Enjoy.

      Delete
    2. FYI - they did something about their own firmware upgrade mechanism and it's available here:

      https://github.com/piCorePlayer/rpi-eeprom/releases

      Simply do a search on "tce-load -i rpi-eeprom.tcz" and we'll find the procedures, I'm not adding the direct link to their forum thread just in case the "Artificial UNintelligence" of Google Bots might flag my reply as some kinda spam simply because of having more than one URL.

      Here's the exact title of that forum thread:

      "ANNOUNCE: piCorePlayer 7.0.0"

      BTW, going from a different flavor of pCP 6.1.0 (with optimized kernel version 4.19) to pCP 8.0.0 (with optimized kernel version 5.13) turned out to drop the CPU Temperature from 47 to 42 but we're talking about Compute Module 4 here.

      Delete
    3. They should integrate it into the WEB UI and should offer an automatic or manual method, with an option to configure the bootloader and to choose a certain firmware release stage (beta,stabil,...)

      Delete
  6. Hello Klaus;
    Good job, but unfortunately i have an issue during download (I4m using rasptouch from audiophonics ans Picore player 8:
    sKit (1.5) - manager (1.6)
    (c) soundcheck

    welcome tc@Rasptouch
    _______________________________________________________________

    verifying space requirements
    mounting boot partition

    setting up sKit base
    sKit package installation
    backing up pre-installation extensions
    installing sKit related extensions

    ERROR: serious issue while downloading extensions
    ERROR: prior status will be restored
    ERROR: please try once more later or use a different repo server
    ERROR: you could also have look @
    ERROR: >> /mnt/mmcblk0p2/tce/sKit/log/sKit-manager.sh.log
    ERROR: >> ncurses.tcz already on system....Error ncurses.tcz Failed Checks


    restoring pre-sKit extensions

    Hope you can fix this easily. regards Arnaud

    ReplyDelete
    Replies
    1. Hi Arnaud.

      I haven't been looking into sKit for quite a while. Last week I pushed myself to check if everything is fine.
      As a matter of fact, surprise, surprise, I ran into the same issue - last week. The whole pCP package download didn't work.

      The download and processing of packages from the pCP repos never worked satisfactory.

      I am now in the process of rewriting the program to improve the situation. Using my own program.

      I already found a method that seems to work more reliable.
      I plan to launch an updated version next wednesday latest.

      Delete
    2. I released a sKit update. Please check if the issue still occurs.
      The issue was related to pretty annoying performance issues on pCP repo servers. sKit should be able to cope much better with that situation.

      Let me know if you made it work.

      Delete
    3. Hi Klaus,
      sorry: exactly same error message today.
      I had first remove old sKit, restart and re install, without change.
      Arnaud

      Delete
    4. I think I made it clear inside the article that I require solid information for tracing and trouble shooting.

      No infos. No support. It's that easy.

      Preferably, issue a ticket incl. all the infos over at the github project page.

      Good luck.

      Delete
  7. Hello,Klaus,I am trying your skit kit?
    Is that contain tidal connect?I find it very useful and facilitated to stream music from PC to moode 7.4.
    I hope to use it in skit version.
    Thank you!

    ReplyDelete
    Replies
    1. Hello David.

      Tidal, as well as Qobuz and Spotify are supported by the LogitechMedia Server (LMS). You have to enable respective Plugins on LMS under Settings. For Tidal in particular you on top need to install an the additional Tidal app on LMS via mysqueezebox.com. Click the App button on the LMS browser main page.

      sKit won't impact these streaming services. I am running Qobuz myself and a friend of mine runs Tidal.

      Good luck.

      Delete
  8. Hello,Klaus
    After installed sKit,it shows that Squeezelite is not running, LMS is not running,everything seems breakdown?

    ReplyDelete
    Replies
    1. David.

      At the end of the sKit article I posted a list of items I expect you to supply if you run into problems and if you want some support. I'll give support for sKit related bugs ONLY. I do prefer that the tickets are issued over @github.

      If you don't comply, you're on your own. Sorry. I simply don't have time for more support.


      See. If you write "squeezelite AND LMS" is not running, it indicates to me that you didn't even read the instructions that say that a combined squeezelite and LMS operation is not supported.
      You need to develop a basic understanding of what's actually going on.

      Good luck.

      Delete