Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Thread Closed 
My MoOde Sound Tweaks
#1
Please use the script that is available on github to apply the tweak, this reduces the chance of user error and saves time/effort.

Old instructions removed from this post.

https://github.com/dynobot/Linux-Audio-Adjustments



/boot/config.txt

disable_splash=1
hdmi_drive=2
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=audio=off
dtoverlay=allo-digione
#dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
arm_freq=1000
sdram_freq=500
core_freq=400
gpu_freq=300
over_voltage=-3
over_voltage_sdram=-3
max_usb_current=0

Newly created file in /usr/local/sbin/sound.sh....change permimssions with sudo chmod 755 sound.sh then put the path to this file in /etc/rc.local

Find your audio threads with this command and substitute them with the ones below.
ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i "irq"

Look for ksoftirq [should be four of them], mine are numbers 7, 14, 19, 24.


#!/bin/bash

#Reduce Audio thread latency

chrt -f -p 83 7
chrt -f -p 83 14
chrt -f -p 83 19
chrt -f -p 83 24

#Reduce USB latency

modprobe snd-usb-audio nrpacks=1

#Reduce MPD and OS latency

chrt -f -p 81 $(pidof mpd)
taskset -c -p 1 $(pidof mpd) 

#Note mmcblk0 should be your hard drive usually sdX for x86 vs ARM

echo noop > /sys/block/mmcblk0/queue/scheduler
echo 2 > /sys/block/mmcblk0/queue/rq_affinity
echo 0 > /proc/sys/vm/swappiness
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

exit
#2
It is very interesting to have some sh file stings meanings...

Thank you!
#3
Music 
(12-08-2018, 09:08 PM)mactolinux Wrote: It is very interesting to have some sh file stings meanings...

Thank you!

Sure, please report back any differences in sound.

Shy
#4
(12-08-2018, 03:13 PM)Edward Wrote: /boot/config.txt

disable_splash=1
hdmi_drive=2
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=audio=off
dtoverlay=allo-digione
#dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
arm_freq=1000
sdram_freq=500
core_freq=400
gpu_freq=300
over_voltage=-3
over_voltage_sdram=-3
max_usb_current=0

Newly created file in /usr/local/sbin/sound.sh....change permimssions with sudo chmod 755 sound.sh then put the path to this file in /etc/rc.local

Find your audio threads with this command and substitute them with the ones below.
ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i "irq"

Look for ksoftirq [should be four of them], mine are numbers 7, 14, 19, 24.


#!/bin/bash

#Reduce Audio thread latency

chrt -f -p 83 7
chrt -f -p 83 14
chrt -f -p 83 19
chrt -f -p 83 24

#Reduce USB latency

modprobe snd-usb-audio nrpacks=1

#Reduce MPD and OS latency

chrt -f -p 81 $(pidof mpd)
taskset -c -p 1 $(pidof mpd) 

#Note mmcblk0 should be your hard drive usually sdX for x86 vs ARM

echo noop > /sys/block/mmcblk0/queue/scheduler
echo 2 > /sys/block/mmcblk0/queue/rq_affinity
echo 0 > /proc/sys/vm/swappiness
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

exit
@Edward...  Thanks for publishing your experience.

Can you, please, describe your hardware set-up?
#5
(12-09-2018, 06:12 AM)CallMeMike Wrote:
(12-08-2018, 03:13 PM)Edward Wrote: /boot/config.txt

disable_splash=1
hdmi_drive=2
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=audio=off
dtoverlay=allo-digione
#dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
arm_freq=1000
sdram_freq=500
core_freq=400
gpu_freq=300
over_voltage=-3
over_voltage_sdram=-3
max_usb_current=0

Newly created file in /usr/local/sbin/sound.sh....change permimssions with sudo chmod 755 sound.sh then put the path to this file in /etc/rc.local

Find your audio threads with this command and substitute them with the ones below.
ps -eLo pid,cls,rtprio,pri,nice,cmd | grep -i "irq"

Look for ksoftirq [should be four of them], mine are numbers 7, 14, 19, 24.


#!/bin/bash

#Reduce Audio thread latency

chrt -f -p 83 7
chrt -f -p 83 14
chrt -f -p 83 19
chrt -f -p 83 24

#Reduce USB latency

modprobe snd-usb-audio nrpacks=1

#Reduce MPD and OS latency

chrt -f -p 81 $(pidof mpd)
taskset -c -p 1 $(pidof mpd) 

#Note mmcblk0 should be your hard drive usually sdX for x86 vs ARM

echo noop > /sys/block/mmcblk0/queue/scheduler
echo 2 > /sys/block/mmcblk0/queue/rq_affinity
echo 0 > /proc/sys/vm/swappiness
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

exit
@Edward...  Thanks for publishing your experience.

Can you, please, describe your hardware set-up?

RPi
Allo DigiOne Signature
iFi USB Power being powered by a Linear Regulated Power supply being powered by a Balanced Power Supply
Audiogd Master 7 Dac
Audiogd Master 1 Pre
Audiogd Master 3 Amp
Audiogd HE350 power regenerator powering the Dac, Pre and Balanced power supply
#6
Hi,

Are the following params specific to a particular model Pi?

arm_freq=1000
sdram_freq=500
core_freq=400
gpu_freq=300
over_voltage=-3
over_voltage_sdram=-3

-Tim
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
#7
(12-09-2018, 04:37 PM)Tim Curtis Wrote: Hi,

Are the following params specific to a particular model Pi?

arm_freq=1000
sdram_freq=500
core_freq=400
gpu_freq=300
over_voltage=-3
over_voltage_sdram=-3

-Tim

Hi Tim

Those came from Archimago's site....he did some testing on the Rpi and found some 'optimal' settings. They were used with the B+....I do have all the Pi models I might test it out to see if I run into any glitches.

http://archimago.blogspot.com/2017/03/ho...berry.html


The other kernel level settings came from RedHat, so if anyone is wondering if they were just dreamed up....no RedHat actually has a manual on Linux tuning.
#8
Edward  
Thank you for sharing this. All seems clear, more or less, this one is not really:

chrt -f -p 81 $(pidof mpd)

My previous attempt for FIFO in mpd.service, adding CPUSchedulingPolicy=fifo — failed, hi-res files were playing with interruptions. Is the command above doing the same?

Thanks.
#9
(12-10-2018, 12:20 PM)mactolinux Wrote: Edward  
Thank you for sharing this. All seems clear, more or less, this one is not really:

chrt -f -p 81 $(pidof mpd)

My previous attempt for FIFO in mpd.service, adding CPUSchedulingPolicy=fifo — failed, hi-res files were playing with interruptions. Is the command above doing the same?

Thanks.

Hi mactolinux

That line changes the priority of MPD to 81 and the process type to first in first out. Test it on the command line...sudo chrt...... Afterwards you can check top to verify. Works perfectly for me, been using it for nearly a decade.
#10
Okay, so it is the same as was in that config. Strange – didn't work here, for 96 & 192 files at least.


Forum Jump: