Skip to content

Instantly share code, notes, and snippets.

@madskjeldgaard
Last active February 1, 2024 12:28
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madskjeldgaard/c5731e95bc5be9b3e2789b14b1149b6e to your computer and use it in GitHub Desktop.
Save madskjeldgaard/c5731e95bc5be9b3e2789b14b1149b6e to your computer and use it in GitHub Desktop.
Tune Raspberry Pi for audio
#!/usr/bin/env sh
# Install utils for cpu freq
sudo apt-get install cpufrequtils
sudo cpufreq-set -r -g performance
sudo echo "ENABLE="true"
GOVERNOR="performance"
MAX_SPEED="0"
MIN_SPEED="0" " | sudo tee -a /etc/default/cpufrequtils
# Install other useful tools
sudo apt-get install htop git perl vim
# Set CPU governor
sudo sed -i 's/exit 0/sudo cpufreq-set -r -g performance/g' /etc/rc.local
sudo echo "exit 0" | sudo tee -a /etc/rc.local
# Set realtime priority and memlock
sudo echo "
@audio nice -15
@audio - rtprio 90 # maximum realtime priority
@audio - memlock unlimited # maximum locked-in-memory address space (KB)
" | sudo tee -a /etc/security/limits.conf
# Set swappiness
# This setting changes the so-called swappiness of your system,
# or in other words, the moment when your system starts to use its swap partition.
sudo echo "
vm.swappiness = 10
fs.inotify.max_user_watches = 524288
" | sudo tee /etc/sysctl.conf
@madskjeldgaard
Copy link
Author

madskjeldgaard commented Jun 21, 2020

Hi Eric
Thanks for your message. It seems like you have done everything correctly. The only missing part of the puzzle is to tell the SuperCollider server to boot with the amount of channels you need. By default it will be set to 2 but you can set it to 8 or any arbitrary number and then use a multi channel panning UGEN by changing the test file's code to something like:

(
// Change number of hardware channels
~numChannels = 8;
s.options.numOutputBusChannels_(~numChannels);

// Boot server and play sound
s.waitForBoot{
	play{ PanAz.ar(~numChannels, PinkNoise.ar(0.5), LFSaw.kr(0.01)) }
}
)

Hope that helps!

@scientificsound
Copy link

Hi Mads,
That worked, thanks so much!

That shoulda been obvious I suppose, I was slowly getting there... ha

cheers,
-eric

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment