Last active
April 14, 2024 23:12
-
-
Save ajboni/a066454e51ea7e758a78e166d03a4a1f to your computer and use it in GitHub Desktop.
Simple Yad Frontend to set Pipewire metadata and other pro audio shortcuts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Simple Yad Frontend to set Pipewire metadata | |
| # Adapted from this post: https://discourse.ardour.org/t/simple-pipewire-pw-metadata-ui/109207/2 | |
| # sudo cat /etc/sudoers.d/cpupower 20:03:16 | |
| # user ALL=(ALL) NOPASSWD: /usr/bin/cpupower | |
| quantum=$(pw-metadata -n settings 0 clock.force-quantum | sed -n "s/.*value:'\([^']*\)'.*/\1/p") | |
| rate=$(pw-metadata -n settings 0 clock.force-rate | sed -n "s/.*value:'\([^']*\)'.*/\1/p") | |
| governor=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor | head -1) | |
| governors=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | sed 's/ /!/g') | |
| IFS='|' read -ra output <<<\ | |
| $(yad\ | |
| --form --columns=1\ | |
| --field="Quantum (buffer):CB" ''!^$quantum!64!128!256!512!1024!2048\ | |
| --field="Samples/Rate:CB" ''!^$rate!44100!48000!88200!96000\ | |
| --field="CPU Governor:CB" !^$governor\!$governors\ | |
| --field="Run qpwgraph:SW" \ | |
| --height=128\ | |
| --width=480\ | |
| --center\ | |
| --title="Set PipeWire Metadata"\ | |
| --window-icon=preferences\ | |
| --text="Pro Audio Shortcuts"\ | |
| --text-align=center)\ | |
| if ! [[ -z "$output" ]]; then | |
| echo $output | |
| pw-metadata -n settings 0 clock.force-quantum ${output[0]} | |
| pw-metadata -n settings 0 clock.force-rate ${output[1]} | |
| sudo cpupower frequency-set -g ${output[2]} | |
| echo ${output[3]} | |
| fi | |
| # pw-metadata -n settings 2>&1 |\ | |
| # yad\ | |
| # --text-info\ | |
| # --width=540\ | |
| # --height=280\ | |
| # --center\ | |
| # --window-icon=preferences\ | |
| # --title="Current PipeWire Metadata Settings"\ | |
| exit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment