Tweaking the audio performance Rpi3

Raspberry Pi related support

Re: Tweaking the audio performance Rpi3

Postby andrea » 15 Jun 2017, 11:52

Hi all,
I'm new to this forum.
I installed Rune 0.4 and applied all the changes in this list

chattr -i /etc/mpd.conf
Nano /etc/mpd.conf
Add this to the active source:
format "192000:24:2"
samplerate_converter "soxr very high"
then :
Chattr +i /etc/mpd.conf

Example Content
audio_output {
name "bcm2835 ALSA_1"
type "alsa"
device "hw:1,0"
dsd_usb "yes"
auto_resample "no"
auto_format "no"
}

audio_output {
name "USB Audio DAC"
type "alsa"
device "hw:0,0"
dsd_usb "yes"
auto_resample "no"
auto_format "no"
format "192000:16:2"
samplerate_converter "soxr very high"
enabled "yes"
}


Changes to /boot/config.txt
Rune Frost tells me that the changes in this file to the Dram and frequency settings add an 'analogue' sound to the output. Always a good thing... :-)
Note: some of these values may be already present.

nano /boot/config.txt

max_usb_current=1

# memory options
#gpu_mem=64
gpu_mem=16

# Overclocking options
force_turbo=1

avoid_pwm_pll=1
arm_freq=666
over_voltage=-10
gpu_freq=333

# sdram overclock
sdram_freq=333

sdram_schmoo=0x02000020
over_voltage_sdram_p=-5
over_voltage_sdram_i=-14
over_voltage_sdram_c=-6

disable_pvt=1

# HDMI disable
hdmi_blanking=2

Please note: Rune Frost advises that when the ARM voltage is lower than -7, the integrated wi-fi will stop working. If wi-fi is required, you can still use an edimax (or similar) dongle for wi-fi. But going below -7 is quite noticeable.. perhaps it is because of the internal wifi/bluetooth is also then disabled :-)

It should be noted that the best internet link is always an ethernet cable. If your router is not near your hi-fi, a good quality powerplug extender works well for the author, e.g. TP-Link AV500, or similar.


Changes to /boot/cmdline.txt
N.B. Some of these parameters are already present.

Nano /boot/cmdline.txt
dwc_otg.microframe_schedule=0
dwc_otg.nak_holdoff_enable=1
dwc_otg.fiq_fix_enable=0
dwc_otg.microframe_schedule=1
smsc95xx.turbo_mode=N
dwc_otg.lpm_enable=0

Orion Optimize Mods (/var/www/command/orion_optimize.sh)
nano /var/www/command/orion_optimize.sh
##################
# common startup #
##################
#if [ "$PID" != null ]; then
#echo "Set priority for: cifsd"
#renice -20 $PID
#fi
cifsprio pid=$(pidof cifsd)
echo "Set normal priority for: rune_SY_wrk"
renice 20 $(pgrep rune_SY_wrk)
echo "Set normal priority for: rune_PL_wrk"
renice 20 $(pgrep rune_PL_wrk)
echo "Set normal priority for: smbd"
renice 19 $(pidof smbd)
echo "Set normal priority for: nmbd"
renice 19 $(pidof nmbd)
#runeFrost
renice -10 -p 3
renice -10 -p 12
renice -10 -p 16
renice -10 -p 20

Also in /var/www/command/orion_optimize.sh
Find the Sound Profiles section (see below), then modify the ‘# mod 3’ section to look like following lines. This content replaces the original parameters so the original lines must be deleted. Alternatively, they can be commented out by putting a ‘#’ at the start of each line.

##################
# Sound Profiles
##################
# mod 3
if [ "$1" == "OrionV2" ]; then
# runefrost version
ifconfig eth0 mtu 9000
ifconfig wlan0 mtu 9000
ifconfig eth0 txqueuelen 4000
ifconfig wlan0 txqueuelen 4000
echo 0 > /proc/sys/vm/swappiness
modKschedLatency hw=$2 s01=120000 s02=2000000 s03=2000000 s04=2000000 s05=2000000 s06=2000000 s07=2000000 s08=2000000 s09=2000000 s10=2000000 u01=2 u02=2 u03=2 u04=2 u05=2 u06=2 u07=2 u08=2 u09=2 u10=2
#runeFrost
echo -n performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo 1000000 > /proc/sys/kernel/sched_latency_ns
echo 100000 > /proc/sys/kernel/sched_min_granularity_ns
echo 25000 > /proc/sys/kernel/sched_wakeup_granularity_ns
echo 1 > /proc/sys/kernel/hung_task_check_count
echo 20 > /proc/sys/vm/stat_interval
echo -1 > /proc/sys/kernel/sched_rt_runtime_us
echo 5 > /proc/sys/vm/dirty_background_ratio

sleep 2
mpdprio_nice
echo "(OrionV2) sound signature profile"
fi


The sound is great, the best ever made with my Rpi3.

I only have a doubt: if I did not understand, these settings should allow MPD / SOXR to use only one "core" (and always the same!) While looking at using the "top" command, I notice that the Core used is not always the same, but always changes every few seconds.
When I used Moode, I remember to have "isolated" a core to use it from MPD and, to do this, I put in a configure.txt (or cmdline.txt) an "isolate_cpu = 3" (or something similar) statement In the MPD executed script "-c 3" (or something similar).
In the various changes I did on Rune I did not encounter anything like this: I forgot something I did? What are the points that point to the CPU3 system use system?

Thank you all for the great work done
User avatar
andrea
 
Posts: 2
Joined: 15 Jun 2017, 10:00

Re: Tweaking the audio performance Rpi3

Postby pietpara » 04 Sep 2017, 22:22

Hi,

It has been a while since I installed the latest image for the RaspTouch and was wondering if there is a new one and where to find it. I tried finding it on the audiophonics forum but since most is in French I couldn't find anything referring to images for the rasptouch.
Is there a standard support site for it?
Or is there a known documented procedure to install the latest from rune?

Thank you
Pietpara
pietpara
 
Posts: 48
Joined: 12 Jan 2017, 21:17

Re: Tweaking the audio performance Rpi3

Postby Vhond » 04 Jun 2019, 11:04

Discovery wrote:I've compiled a list of all of Rune Frost's changes for the RPi3. Please see below.



To Use SOXR Upscaler (optional – may not work well with all DACs)
Use SOXR to upscale to 192Khz/16bit ( this really depends on the DAC, some will get better performance as the SOXR is a better resampler than some of the integrated ones).

The chattr –i command must precede the edit and the chattr +I must follow the edit. The mpd.conf file is locked for editing - the first chattr command unlocks it; the second locks it after changes.

Please note – the ‘active source’ is usually the section that has ‘enabled “yes”’ in it. In the example below, this is my USB Audio DAC – the second section, where the lines have been added.

Note: Other upsampling values also work, e.g. 96000:16:2

chattr -i /etc/mpd.conf
Nano /etc/mpd.conf

Add this to the active source:
format "192000:24:2"
samplerate_converter "soxr very high"

then :
Chattr +i /etc/mpd.conf

Example Content
audio_output {
name "bcm2835 ALSA_1"
type "alsa"
device "hw:1,0"
dsd_usb "yes"
auto_resample "no"
auto_format "no"
}

audio_output {
name "USB Audio DAC"
type "alsa"
device "hw:0,0"
dsd_usb "yes"
auto_resample "no"
auto_format "no"
format "192000:16:2"
samplerate_converter "soxr very high"

enabled "yes"
}


Changes to /boot/config.txt
Rune Frost tells me that the changes in this file to the Dram and frequency settings add an 'analogue' sound to the output. Always a good thing... :-)
Note: some of these values may be already present.

nano /boot/config.txt

max_usb_current=1

# memory options
#gpu_mem=64
gpu_mem=16

# Overclocking options
force_turbo=1

avoid_pwm_pll=1
arm_freq=666
over_voltage=-10
gpu_freq=333

# sdram overclock
sdram_freq=333

sdram_schmoo=0x02000020
over_voltage_sdram_p=-5
over_voltage_sdram_i=-14
over_voltage_sdram_c=-6

disable_pvt=1

# HDMI disable
hdmi_blanking=2


Please note: Rune Frost advises that when the ARM voltage is lower than -7, the integrated wi-fi will stop working. If wi-fi is required, you can still use an edimax (or similar) dongle for wi-fi. But going below -7 is quite noticeable.. perhaps it is because of the internal wifi/bluetooth is also then disabled :-)

It should be noted that the best internet link is always an ethernet cable. If your router is not near your hi-fi, a good quality powerplug extender works well for the author, e.g. TP-Link AV500, or similar.


Changes to /boot/cmdline.txt
N.B. Some of these parameters are already present.

Nano /boot/cmdline.txt
dwc_otg.microframe_schedule=0
dwc_otg.nak_holdoff_enable=1
dwc_otg.fiq_fix_enable=0
dwc_otg.microframe_schedule=1
smsc95xx.turbo_mode=N
dwc_otg.lpm_enable=0


Orion Optimize Mods (/var/www/command/orion_optimize.sh)
nano /var/www/command/orion_optimize.sh
##################
# common startup #
##################
#if [ "$PID" != null ]; then
#echo "Set priority for: cifsd"
#renice -20 $PID
#fi
cifsprio pid=$(pidof cifsd)
echo "Set normal priority for: rune_SY_wrk"
renice 20 $(pgrep rune_SY_wrk)
echo "Set normal priority for: rune_PL_wrk"
renice 20 $(pgrep rune_PL_wrk)
echo "Set normal priority for: smbd"
renice 19 $(pidof smbd)
echo "Set normal priority for: nmbd"
renice 19 $(pidof nmbd)
#runeFrost
renice -10 -p 3
renice -10 -p 12
renice -10 -p 16
renice -10 -p 20


Also in /var/www/command/orion_optimize.sh
Find the Sound Profiles section (see below), then modify the ‘# mod 3’ section to look like following lines. This content replaces the original parameters so the original lines must be deleted. Alternatively, they can be commented out by putting a ‘#’ at the start of each line.

##################
# Sound Profiles
##################
# mod 3
if [ "$1" == "OrionV2" ]; then
# runefrost version
ifconfig eth0 mtu 9000
ifconfig wlan0 mtu 9000
ifconfig eth0 txqueuelen 4000
ifconfig wlan0 txqueuelen 4000
echo 0 > /proc/sys/vm/swappiness
modKschedLatency hw=$2 s01=120000 s02=2000000 s03=2000000 s04=2000000 s05=2000000 s06=2000000 s07=2000000 s08=2000000 s09=2000000 s10=2000000 u01=2 u02=2 u03=2 u04=2 u05=2 u06=2 u07=2 u08=2 u09=2 u10=2
#runeFrost
echo -n performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo -n performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo 1000000 > /proc/sys/kernel/sched_latency_ns
echo 100000 > /proc/sys/kernel/sched_min_granularity_ns
echo 25000 > /proc/sys/kernel/sched_wakeup_granularity_ns
echo 1 > /proc/sys/kernel/hung_task_check_count
echo 20 > /proc/sys/vm/stat_interval
echo -1 > /proc/sys/kernel/sched_rt_runtime_us
echo 5 > /proc/sys/vm/dirty_background_ratio

sleep 2
mpdprio_nice
echo "(OrionV2) sound signature profile"
fi



Somebody tried these adjustments for Rune 0.5b? Maybe other recommendations ('cause this topic hasn't been updated for more than 1 year ;) )
Vhond
 
Posts: 35
Joined: 11 Apr 2017, 18:06

Re: Tweaking the audio performance Rpi3

Postby Vhond » 09 Aug 2019, 14:40

I can confirm these alterations still work for beta 0.5, but it seems after every gitpull the orion_optimize.sh file is overwritten (to default)?
Vhond
 
Posts: 35
Joined: 11 Apr 2017, 18:06

support RuneAudio Donate with PayPal

Previous

Return to Raspberry Pi

Who is online

Users browsing this forum: cmh714 and 11 guests