├── DEBIAN ├── preinst ├── postinst ├── control └── changelog ├── share ├── pulseaudio-equalizer │ ├── pulseaudio-equalizer-logo.png │ ├── presets │ │ ├── Flat.preset │ │ ├── Laptop.preset │ │ ├── Club.preset │ │ ├── Gospel.preset │ │ ├── Live.preset │ │ ├── Party.preset │ │ ├── Pop.preset │ │ ├── Ska.preset │ │ ├── Soft.preset │ │ ├── Boosted.preset │ │ ├── Reggae.preset │ │ ├── Blues.preset │ │ ├── Dance.preset │ │ ├── Rock.preset │ │ ├── Techno.preset │ │ ├── Bass Boost.preset │ │ ├── Headphones.preset │ │ ├── Large Hall.preset │ │ ├── Perfect EQ.preset │ │ ├── Soft Rock.preset │ │ ├── Full Bass.preset │ │ ├── Classical.preset │ │ ├── Full Treble.preset │ │ ├── Slight Bass Boost.preset │ │ ├── Full Bass & Treble.preset │ │ ├── jjo-sony-MDR-V300.preset │ │ └── Bose QuietComfort 35.preset │ ├── equalizer.ui │ └── pulseaudio-equalizer.py └── applications │ └── pulseaudio-equalizer.desktop ├── bin ├── pulseaudio-equalizer-gtk └── pulseaudio-equalizer ├── equalizerrc ├── PKGBUILD ├── .gitignore └── README.md /DEBIAN/preinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | sudo mkdir -p /usr/share/pulseaudio-equalizer/presets 5 | -------------------------------------------------------------------------------- /DEBIAN/postinst: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | sudo xdg-desktop-menu install /usr/share/applications/pulseaudio-equalizer.desktop 5 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/pulseaudio-equalizer-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/larmedina75/pulseaudio-equalizer-ladspa/HEAD/share/pulseaudio-equalizer/pulseaudio-equalizer-logo.png -------------------------------------------------------------------------------- /bin/pulseaudio-equalizer-gtk: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # PulseAudio LADSPA Equalizer - wrapper script 4 | # Author: Conn O'Griofa 5 | # Version: (see '/usr/pulseaudio-equalizer' script) 6 | 7 | #python3 /usr/share/pulseaudio-equalizer/pulseaudio-equalizer.py 8 | python3 ../share/pulseaudio-equalizer/pulseaudio-equalizer.py -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Flat.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2.0 5 | Flat 6 | 15 7 | 0 8 | 0 9 | 0 10 | 0 11 | 0 12 | 0 13 | 0 14 | 0 15 | 0 16 | 0 17 | 0 18 | 0 19 | 0 20 | 0 21 | 0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Laptop.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Laptop 6 | 15 7 | -1 8 | -1 9 | -1 10 | -1 11 | -5 12 | -10 13 | -18 14 | -15 15 | -10 16 | -5 17 | -5 18 | -5 19 | -5 20 | 0 21 | 0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /equalizerrc: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | jjo4 6 | 1 7 | 1 8 | -30 9 | 30 10 | 15 11 | 3.0 12 | 7.0 13 | 7.3 14 | 7.0 15 | 3.0 16 | -1.0 17 | -6.6 18 | -6.3 19 | -4.5 20 | -4.0 21 | 3.1 22 | 7.9 23 | 9.6 24 | 9.9 25 | 6.8 26 | 50 27 | 100 28 | 156 29 | 220 30 | 311 31 | 440 32 | 622 33 | 880 34 | 1250 35 | 1750 36 | 2500 37 | 3500 38 | 5000 39 | 10000 40 | 20000 41 | -------------------------------------------------------------------------------- /share/applications/pulseaudio-equalizer.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Version=1.0 3 | Encoding=UTF-8 4 | Name=PulseAudio Equalizer 5 | GenericName=Equalizer 6 | Comment=PulseAudio LADSPA interface using MBEQ Multiband EQ plugin 7 | Exec=pulseaudio-equalizer-gtk 8 | Icon=multimedia-volume-control 9 | StartupNotify=true 10 | Type=Application 11 | Categories=AudioVideo;Audio;Mixer;GTK; 12 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Club.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Club 6 | 15 7 | -0.2 8 | -0.2 9 | -0.2 10 | -0.2 11 | 3.5 12 | 3.5 13 | 3.5 14 | 3.5 15 | 3.5 16 | 3.5 17 | 3.5 18 | 2.5 19 | 2.5 20 | 0.0 21 | 0.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Gospel.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 5 | Gospel 6 | 15 7 | 6.5 8 | 7.1 9 | 0.8 10 | -3.7 11 | -5.0 12 | 0.3 13 | 0.8 14 | 0.8 15 | 2.5 16 | 2.8 17 | 3.8 18 | 4.5 19 | 5.8 20 | 7.1 21 | 9.4 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Live.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Live 6 | 15 7 | -9.0 8 | -5.5 9 | 0.0 10 | 1.5 11 | 2.1 12 | 3.4 13 | 3.4 14 | 3.4 15 | 3.4 16 | 3.4 17 | 3.4 18 | 3.4 19 | 2.8 20 | 1.6 21 | 1.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Party.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Party 6 | 15 7 | 4.8 8 | 4.8 9 | 4.8 10 | 3.1 11 | 0.0 12 | 0.0 13 | 0.0 14 | 0.0 15 | 0.0 16 | 0.0 17 | 0.0 18 | 0.0 19 | 0.0 20 | 2.5 21 | 4.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Pop.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Pop 6 | 15 7 | -3.4 8 | 1.7 9 | 2.0 10 | 3.0 11 | 5.0 12 | 5.6 13 | 6.5 14 | 5.2 15 | 3.2 16 | 1.5 17 | 0.0 18 | -2.5 19 | -4.8 20 | -4.8 21 | -3.2 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Ska.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Ska 6 | 15 7 | -4.5 8 | -8.1 9 | -8.9 10 | -8.5 11 | -8.0 12 | -6.0 13 | 0.0 14 | 1.5 15 | 2.5 16 | 2.7 17 | 3.2 18 | 3.3 19 | 5.8 20 | 6.4 21 | 6.4 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Soft.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Soft 6 | 15 7 | 3.2 8 | 2.8 9 | 0.8 10 | 0.9 11 | 0.0 12 | -2.4 13 | -4.8 14 | 1.5 15 | 0.0 16 | 1.1 17 | 3.0 18 | 3.0 19 | 5.8 20 | 7.8 21 | 7.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Boosted.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | Boosted 6 | 15 7 | 5.0 8 | 5.0 9 | 4.0 10 | 0.0 11 | 0.0 12 | 1.0 13 | 1.0 14 | 1.0 15 | 1.0 16 | 2.0 17 | 2.0 18 | 4.0 19 | 3.0 20 | 3.0 21 | 2.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Reggae.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Reggae 6 | 15 7 | 0.0 8 | 0.0 9 | 0.0 10 | 0.0 11 | 0.0 12 | -4.5 13 | -10.0 14 | -6.0 15 | 0.5 16 | 1.0 17 | 2.0 18 | 4.0 19 | 4.0 20 | 0.0 21 | 0.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Blues.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 5 | Blues 6 | 15 7 | -0.2 8 | 5.5 9 | 2.2 10 | -0.2 11 | -0.2 12 | -0.2 13 | -0.2 14 | -0.5 15 | 4.1 16 | 4.1 17 | 7.1 18 | 7.1 19 | -13.1 20 | -12.4 21 | 8.1 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Dance.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Dance 6 | 15 7 | 6.1 8 | 4.3 9 | 4.3 10 | 1.7 11 | 1.7 12 | 1.7 13 | -0.1 14 | -0.1 15 | -0.1 16 | 0.8 17 | -10.7 18 | -14.2 19 | -15.1 20 | -7.2 21 | 0.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Rock.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Rock 6 | 15 7 | 5.3 8 | 2.6 9 | 2.6 10 | -8.5 11 | -10.5 12 | -11.2 13 | -16.0 14 | -14.7 15 | -6.6 16 | -5.7 17 | -3.0 18 | 3.0 19 | 6.7 20 | 7.3 21 | 7.3 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Techno.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Techno 6 | 15 7 | 5.0 8 | 4.0 9 | 3.9 10 | 3.3 11 | 0.0 12 | -4.5 13 | -10.0 14 | -8.9 15 | -8.1 16 | -5.5 17 | -1.5 18 | 3.0 19 | 6.0 20 | 6.1 21 | 5.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Bass Boost.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | Bass Boost 6 | 15 7 | 17 8 | 15 9 | 11.5 10 | 8.5 11 | 3.5 12 | 0.3 13 | -1.0 14 | -2.0 15 | -2.0 16 | 0.0 17 | 0.0 18 | 2.0 19 | 3.0 20 | 3.0 21 | 3.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Headphones.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Headphones 6 | 15 7 | 3.0 8 | 3.0 9 | 7.3 10 | 7.0 11 | 3.0 12 | -1.0 13 | -6.6 14 | -6.3 15 | -4.5 16 | -4.0 17 | 1.1 18 | 1.2 19 | 5.8 20 | 7.9 21 | 8.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Large Hall.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Large Hall 6 | 15 7 | 7.0 8 | 7.0 9 | 7.0 10 | 3.5 11 | 3.0 12 | 3.0 13 | 3.0 14 | 1.5 15 | 0.0 16 | -2.0 17 | -3.5 18 | -6.0 19 | -9.0 20 | -1.0 21 | 0.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Perfect EQ.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | Perfect EQ 6 | 15 7 | 4.0 8 | 2.0 9 | 1.0 10 | 0.0 11 | 0.0 12 | -1.0 13 | -1.0 14 | -2.0 15 | -2.0 16 | 0.0 17 | 0.0 18 | 2.0 19 | 3.0 20 | 3.0 21 | 3.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Soft Rock.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Soft Rock 6 | 15 7 | 2.7 8 | 2.7 9 | 2.7 10 | 1.5 11 | 1.5 12 | 1.4 13 | 0.0 14 | -3.6 15 | -8.0 16 | -7.2 17 | -9.8 18 | -8.9 19 | -6.6 20 | 1.4 21 | 5.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Full Bass.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Full Bass 6 | 15 7 | -16.0 8 | -16.0 9 | 6.5 10 | 6.5 11 | 6.0 12 | 5.5 13 | 4.5 14 | 1.0 15 | 1.0 16 | 1.0 17 | -8.0 18 | -10.0 19 | -16.0 20 | -16.0 21 | -20.4 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Classical.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Classical 6 | 15 7 | -0.2 8 | -0.2 9 | -0.2 10 | -0.2 11 | -0.2 12 | -0.2 13 | -0.2 14 | -0.2 15 | -0.2 16 | -0.2 17 | -0.2 18 | -0.2 19 | -21.0 20 | -21.0 21 | -27.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Full Treble.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Full Treble 6 | 15 7 | 4.8 8 | -18.6 9 | -18.6 10 | -18.6 11 | -18.6 12 | -10.0 13 | -8.0 14 | -6.5 15 | 1.5 16 | 1.5 17 | 1.5 18 | 8.5 19 | 10.6 20 | 10.6 21 | 10.6 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Slight Bass Boost.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | Slight Bass Boost 6 | 15 7 | 15.0 8 | 13.5 9 | 10.0 10 | 7.0 11 | 3.0 12 | 0.3 13 | -1.0 14 | -2.0 15 | -2.0 16 | 0.0 17 | 0.0 18 | 2.0 19 | 3.0 20 | 3.0 21 | 3.0 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Full Bass & Treble.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 2 5 | Full Bass & Treble 6 | 15 7 | 4.8 8 | 4.8 9 | 3.5 10 | 2.5 11 | 0.0 12 | -7.0 13 | -14.0 14 | -10.0 15 | -10.0 16 | -8.0 17 | 1.0 18 | 1.0 19 | 5.2 20 | 7.7 21 | 9.5 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/jjo-sony-MDR-V300.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | jjo-sony-MDR-V300.preset 6 | 15 7 | 3.0 8 | 7.0 9 | 7.3 10 | 7.0 11 | 3.0 12 | -1.0 13 | -6.6 14 | -6.3 15 | -4.5 16 | -4.0 17 | 3.1 18 | 7.9 19 | 9.6 20 | 9.9 21 | 6.8 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/presets/Bose QuietComfort 35.preset: -------------------------------------------------------------------------------- 1 | mbeq_1197 2 | mbeq 3 | Multiband EQ 4 | 1.0 5 | Bose QCon 35 6 | 15 7 | 6.1 8 | 3.7 9 | -2.0 10 | -3.7 11 | -5.0 12 | -10.0 13 | -11.5 14 | -11.5 15 | -10.0 16 | -5.0 17 | -2.7 18 | -1.0 19 | -1.3 20 | 2.4 21 | 5.7 22 | 50 23 | 100 24 | 156 25 | 220 26 | 311 27 | 440 28 | 622 29 | 880 30 | 1250 31 | 1750 32 | 2500 33 | 3500 34 | 5000 35 | 10000 36 | 20000 37 | -------------------------------------------------------------------------------- /DEBIAN/control: -------------------------------------------------------------------------------- 1 | Package: pulseaudio-equalizer-ladspa 2 | Version: 2022.08.0 3 | Architecture: all 4 | Maintainer: Luis Armando Medina Avitia 5 | Installed-Size: 6 6 | Depends: swh-plugins, pulseaudio, python3-gi, libgtk-3-0 7 | Section: admin 8 | Priority: optional 9 | Homepage: https://www.comoinstalarlinux.com/pulseaudio-equalizer-ladspa/ 10 | Standards-Version: 4.0.0 11 | Description: PulseAudio Equalizer - LADSPA plugin graphical user interface 12 | GUI for PulseAudio's LADSPA interface using Steve Harris' Multiband EQ (mbeq_1197) plugin 13 | -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: FFY00 2 | pkgname=pulseaudio-equalizer-ladspa 3 | pkgver=1.0.r0.4856f57 4 | pkgrel=3 5 | pkgdesc="A 15-band equalizer for PulseAudio" 6 | arch=(any) 7 | url="https://github.com/larmedina75/pulseaudio-equalizer-ladspa" 8 | license=('GPL3') 9 | depends=('python-gobject' 'gtk3' 'swh-plugins' 'pulseaudio' 'bc') 10 | makedepends=('git') 11 | provides=('pulseaudio-equalizer-ladspa') 12 | conflicts=('pulseaudio-equalizer-ladspa') 13 | replaces=('pulseaudio-equalizer-ladspa') 14 | source=('remote::git+https://github.com/larmedina75/pulseaudio-equalizer-ladspa') 15 | md5sums=('SKIP') 16 | 17 | pkgver() { 18 | cd "$srcdir/remote" 19 | git describe --long --tags | sed 's/^v//;s/\([^-]*-\)g/r\1/;s/-/./g;s/\.rc./rc/g' 20 | } 21 | 22 | package() { 23 | install -Dm644 "$srcdir/equalizerrc" "$pkgdir/usr/equalizerrc" 24 | 25 | cp -r "$srcdir/share" "$pkgdir/usr/" 26 | cp -r "$srcdir/bin" "$pkgdir/usr/" 27 | } 28 | -------------------------------------------------------------------------------- /DEBIAN/changelog: -------------------------------------------------------------------------------- 1 | pulseaudio-equalizer-ladspa (2022.08.0-0_all) ; urgency=low 2 | 3 | version 2022.08 4 | 5 | * Debian packages for Ubuntu 21.10 and earlier with zstd compression support 6 | * Debian packages with tar.zx compression support 7 | * Fixed error when trying to delete a non user preset 8 | * Fixed LADSPA plugin multiband EQ module listed after uninstall 9 | * if swh plug-ins are not installed, a warning message is displayed 10 | 11 | version 2022.07 12 | 13 | * Import presets by drag and drop a .preset file, feature enabled again. 14 | * Fixed error that mishandle the actual preset list when a personal preset is deleted 15 | 16 | version 2021.11 17 | 18 | * Improves detection of actions and changes on pesets 19 | * Fixed detection of pulseaudio equalizer status on initialization 20 | * Fixed bad sync to header bar and tool bar controls (preset box and enable/disable switch) 21 | * Fixed error when equzliaer plugin for pulse audio is not present 22 | 23 | version 2021.10 24 | 25 | * Export a preset 26 | * Import a preset 27 | * Gnome 3 header bar enable / disable 28 | * Option to get a traditional interface (menu and tool-bar, yeah I do hate header bars) 29 | * Save modified frecuencies set as a new preset 30 | * Delete local conf. presets 31 | * Enhanced Save Preset 32 | * About dialog and credits 33 | * Equilizer polished inteface 34 | 35 | version 2.7.2 36 | 37 | * Add a failcheck when the equalizer sink is loaded 38 | * Add more presets (useful presets, ex. Bass Boost) 39 | * Enanced Save Preset 40 | * Add Export preset 41 | * Add Import preset 42 | * About dialog and credits 43 | * Enabled import presets by drag and drop a .preset files 44 | 45 | -- Luis Armando Medina Tue, 03 Oct 2017 13:30:57 +0200 46 | 47 | 48 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow 98 | __pypackages__/ 99 | 100 | # Celery stuff 101 | celerybeat-schedule 102 | celerybeat.pid 103 | 104 | # SageMath parsed files 105 | *.sage.py 106 | 107 | # Environments 108 | .env 109 | .venv 110 | env/ 111 | venv/ 112 | ENV/ 113 | env.bak/ 114 | venv.bak/ 115 | 116 | # Spyder project settings 117 | .spyderproject 118 | .spyproject 119 | 120 | # Rope project settings 121 | .ropeproject 122 | 123 | # mkdocs documentation 124 | /site 125 | 126 | # mypy 127 | .mypy_cache/ 128 | .dmypy.json 129 | dmypy.json 130 | 131 | # Pyre type checker 132 | .pyre/ 133 | 134 | # pytype static type analyzer 135 | .pytype/ 136 | 137 | # Cython debug symbols 138 | cython_debug/ 139 | 140 | *.sublime-project 141 | *.sublime-workspace 142 | *.ui~ 143 | 144 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Pulseaudio Equalizer 2 | A LADSPA based multiband equalizer approach for getting better sound out of PulseAudio. 3 | This equalizer clearly is more potent and easy to use than previous versions. 4 | 5 | I like to play Spotify or other audio sources and get a good sound. Other equalizers work great but it uses Gnome 3 header bar and I do really hate this header bars distribution, so I try to fix this, and I add some extra features. 6 | 7 | 8 | ![Image of Pulseaudio equalizer for Linux](https://www.comoinstalarlinux.com/wp-content/uploads/pulseaudio-equalizer-ladspa-2021.11-comoinstalarlinux.com-equalizer-ecualizador-liunx-ubuntu-mint-debian-mx-gtk3-gnome3.png) 9 | 10 | ## Features on version 2024.07 11 | 12 | * Export all user presets to a folder is posible 13 | * Tow more presets added Gospel, and Blues 14 | * Fixed error when trying to delete a non user preset 15 | * Fixed LADSPA plugin multiband EQ module listed after uninstall 16 | * if swh plug-ins are not installed, a warning message is displayed 17 | 18 | ## Features on version 2022.07 19 | 20 | * Debian packages for Ubuntu 21.10 and earlier with zstd compression support 21 | * Debian packages with tar.zx compression support 22 | * Import presets by drag and drop a .preset file, feature enabled again. 23 | * Fixed error that mishandle the actual preset list when a personal preset is deleted 24 | 25 | ## Features on version 2021.11 26 | 27 | * Fixed preset file import Error, dialog freeze 28 | * Improves detection of actions and preset changes 29 | * Fixed detection of PulseAudio equalizer status on initialization 30 | * Fixed bad sync to header bar and toolbar controls (preset box and enable/disable switch) 31 | * Fixed error when equalizer plugin for PulseAudio is not present 32 | 33 | ## Features on version 2021.10 34 | 35 | * Export a preset 36 | * Import a preset 37 | * Gnome 3 header bar enable/disable switch 38 | * Option to have a traditional interface (menu and tool-bar, yeah I do hate header bars) 39 | * Save modified frequencies set as a new preset 40 | * Delete local conf. presets 41 | * Enhanced Save Preset 42 | * About dialog, credits, and license 43 | * Equalizer polished interface 44 | 45 | ## Todo 46 | 47 | * Automatically detect non Gnome 3 Desktop environments (MATE, Cinnamon, XFce, etc.) 48 | * Multi language support 49 | * experimental pipewire support 50 | 51 | ### Original Sources 52 | 53 | https://github.com/pulseaudio-equalizer-ladspa/equalizer 54 | https://code.launchpad.net/~psyke83/+junk/pulseaudio-equalizer 55 | https://github.com/jjo/config/tree/master/.pulse 56 | 57 | ### Donations and Support 58 | 59 | If you think this software is useful or you want to support its development and maintenance, make a donation. 60 | 61 | You can contribute from 0.00004 to 1 bitcoin or just a tip for a cup of coffee, caffeine always helps to write more and better software. 62 | 63 | BTC: 3CvPpZKtX6n4qXrscJNqcwL5Ps5Y1Ydkex 64 | XMR: 42yQLLnxiNR2teFXBorZi3cpARqRDUfcMDTHJMyUry3mB8nH8jiSPUJgtrjWPL5jMu9paHU7fsemhdNub3Xo5itfQwwMiVG 65 | -------------------------------------------------------------------------------- /bin/pulseaudio-equalizer: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # PulseAudio LADSPA Equalizer - support script 4 | # Author: Conn O'Griofa 5 | # 6 | # Intended for use in conjunction with PulseAudio Equalizer (pulseaudio-equalizer.py/pulseaudio-equalizer-gtk) PyGTK script. 7 | # 8 | 9 | # Don't execute the script with elevated privileges 10 | [[ $EUID = 0 ]] && { echo "This script must not be run as root!"; exit 1; } 11 | 12 | # Default LADSPA plugin & control settings; settings will be overridden if $CONFIG_NAME file exists. 13 | PA_LADSPA_PLUGIN="mbeq_1197" 14 | PA_LADSPA_PLUGIN_NAME="Multiband EQ" 15 | PA_LADSPA_LABEL="mbeq" 16 | PA_NUM_LADSPA_INPUTS="15" 17 | PA_LADSPA_CONTROLS="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" 18 | PA_LADSPA_INPUTS="50,100,156,220,311,440,622,880,1250,1750,2500,3500,5000,10000,20000" 19 | PA_CONTROL_MIN="-30" 20 | PA_CONTROL_MAX="30" 21 | PA_PREAMP="1.0" 22 | PA_CURRENT_PRESET="" 23 | 24 | PRESET_DIR1=$HOME/.config/pulse/presets 25 | PRESET_DIR2=/usr/share/pulseaudio-equalizer/presets 26 | SCRIPT_NAME=./pulseaudio-equalizer 27 | #SCRIPT_NAME=pulseaudio-equalizer 28 | SCRIPT_VERSION="4.1 (29.01.2017)" 29 | CONFIG_NAME=$HOME/.config/pulse/equalizerrc 30 | LOG_NAME=$HOME/pulseaudio-equalizer.log 31 | 32 | # PyGTK Interface - Reset Settings 33 | if [ "$1" = "interface.resetsettings" ]; then 34 | # Convert commas into newlines and dump all settings to configuration file 35 | echo $PA_LADSPA_PLUGIN,$PA_LADSPA_LABEL,$PA_LADSPA_PLUGIN_NAME,$PA_PREAMP,$PA_CURRENT_PRESET,$PA_EQUALIZER_STATUS,$PA_EQUALIZER_PERSISTENCE,$PA_CONTROL_MIN,$PA_CONTROL_MAX,$PA_NUM_LADSPA_INPUTS,$PA_LADSPA_CONTROLS,$PA_LADSPA_INPUTS | sed 's/,/\n/g' >$CONFIG_NAME 36 | 37 | $SCRIPT_NAME disable-config 38 | $SCRIPT_NAME disable 39 | exit 40 | fi 41 | 42 | # If $CONFIG_NAME file exists, override built-in control settings with user-customized values 43 | if [ -f $CONFIG_NAME ]; then 44 | # Read configuration file into "MYARRAY" array 45 | index=0 46 | while read line ; do 47 | MYARRAY[$index]="$line" 48 | index=$(($index+1)) 49 | done < $CONFIG_NAME 50 | 51 | # Grab simple values 52 | PA_LADSPA_PLUGIN="${MYARRAY[0]}" 53 | PA_LADSPA_LABEL=${MYARRAY[1]} 54 | PA_LADSPA_PLUGIN_NAME=${MYARRAY[2]} 55 | PA_PREAMP=${MYARRAY[3]} 56 | PA_CURRENT_PRESET=${MYARRAY[4]} 57 | PA_EQUALIZER_STATUS=${MYARRAY[5]} 58 | PA_EQUALIZER_PERSISTENCE=${MYARRAY[6]} 59 | PA_CONTROL_MIN=${MYARRAY[7]} 60 | PA_CONTROL_MAX=${MYARRAY[8]} 61 | PA_NUM_LADSPA_INPUTS=${MYARRAY[9]} 62 | 63 | # Unpack controls from array 64 | index=0 65 | current=10 66 | while [ $index -lt $PA_NUM_LADSPA_INPUTS ]; do 67 | RAWDATA1="$RAWDATA1 ${MYARRAY[$current]}" 68 | index=$(($index+1)) 69 | current=$(($current+1)) 70 | done 71 | # Convert spaces into commas 72 | PA_LADSPA_CONTROLS=$(echo $RAWDATA1 | sed 's/ /,/g') 73 | 74 | # Unpack inputs from array 75 | index=0 76 | current=$((10+$PA_NUM_LADSPA_INPUTS)) 77 | while [ $index -lt $PA_NUM_LADSPA_INPUTS ]; do 78 | RAWDATA2="$RAWDATA2 ${MYARRAY[$current]}" 79 | index=$(($index+1)) 80 | current=$(($current+1)) 81 | done 82 | # Convert spaces into commas 83 | PA_LADSPA_INPUTS=$(echo $RAWDATA2 | sed 's/ /,/g') 84 | fi 85 | 86 | # PyGTK Interface - Apply Settings 87 | if [ "$1" = "interface.applysettings" ]; then 88 | # Process new settings 89 | if [ "$PA_EQUALIZER_PERSISTENCE" = "1" ]; then 90 | echo "Enabling persistence..." 91 | $SCRIPT_NAME enable-config 92 | elif [ "$PA_EQUALIZER_PERSISTENCE" = "0" ]; then 93 | echo "Disabling persistence..." 94 | $SCRIPT_NAME disable-config 95 | fi 96 | 97 | if [ "$PA_EQUALIZER_STATUS" = "1" ]; then 98 | echo "Enabling..." 99 | $SCRIPT_NAME enable 100 | elif [ "$PA_EQUALIZER_STATUS" = "0" ]; then 101 | echo "Disabling..." 102 | $SCRIPT_NAME disable 103 | fi 104 | exit 105 | fi 106 | 107 | # Get sink names and volumes 108 | PA_LADSPA_SINK="ladspa_output.$PA_LADSPA_PLUGIN.$PA_LADSPA_LABEL" 109 | PA_CURRENT_SINK=$(pacmd stat | grep --color=never "Default sink name" | sed 's/Default sink name: //g') 110 | PA_CURRENT_VOLUME=$(pacmd list | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'volume: ' | grep --color=never -Po '(\d+)%' | awk 'NR==1{sub(/%/,"",$1); print $1}') 111 | PA_REAL_VOLUME=$((PA_CURRENT_VOLUME*65536/100)) 112 | PA_REAL_PREAMP_FLOAT=$(echo "$PA_PREAMP*65536" | bc) 113 | PA_REAL_PREAMP=${PA_REAL_PREAMP_FLOAT/\.*} 114 | PA_CURRENT_MUTE=$(pacmd list-sinks | grep --color=never -A20 "<$PA_CURRENT_SINK>" | grep -m1 'muted: ' | sed 's/[\t]muted: no/0/g' | sed 's/[\t]muted: yes/1/g') 115 | 116 | # Check if equalizer is running and get accurate master sink name 117 | if [ "$PA_CURRENT_SINK" = "$PA_LADSPA_SINK" ]; then 118 | PA_EQUALIZER_STATUS=1 119 | PA_MASTER_SINK=$(pacmd info | grep --color=never -A30 "<$PA_CURRENT_SINK>" | grep --color=never -m1 'device.master_device = ' | sed 's/device.master_device = //g' | sed 's/"//g' | sed 's/^[ \t]*//') 120 | else 121 | PA_EQUALIZER_STATUS=0 122 | PA_MASTER_SINK=$(pacmd stat | grep --color=never 'Default sink name' | sed 's/Default sink name: //g') 123 | fi 124 | 125 | # Check if equalizer is set as persistent 126 | if [ -f $HOME/.config/pulse/default.pa ]; then 127 | if [ "$(cat $HOME/.config/pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then 128 | PA_EQUALIZER_PERSISTENCE=1 129 | else 130 | PA_EQUALIZER_PERSISTENCE=0 131 | fi 132 | else 133 | PA_EQUALIZER_PERSISTENCE=0 134 | fi 135 | 136 | # DEBUG 137 | if [ "$1" = "debug" ]; then 138 | echo "Please wait (approximate time: 25 seconds)..." 139 | sleep 3 140 | echo >$LOG_NAME "State: Initial state" 141 | echo >>$LOG_NAME "---" 142 | $SCRIPT_NAME log >>$LOG_NAME 143 | 144 | $SCRIPT_NAME disable-config >/dev/null 145 | pulseaudio -k 146 | sleep 10 147 | 148 | # Disabled/not saved 149 | $SCRIPT_NAME disable >/dev/null 150 | $SCRIPT_NAME disable-config >/dev/null 151 | sleep 3 152 | echo >>$LOG_NAME "State: Disabled [not saved]" 153 | echo >>$LOG_NAME "---" 154 | $SCRIPT_NAME log >>$LOG_NAME 155 | 156 | # Enabled/not saved 157 | $SCRIPT_NAME enable >/dev/null 158 | $SCRIPT_NAME disable-config >/dev/null 159 | sleep 3 160 | echo >>$LOG_NAME "State: Enabled [not saved]" 161 | echo >>$LOG_NAME "---" 162 | $SCRIPT_NAME log >>$LOG_NAME 163 | 164 | # Disabled/saved 165 | $SCRIPT_NAME disable >/dev/null 166 | $SCRIPT_NAME enable-config >/dev/null 167 | sleep 3 168 | echo >>$LOG_NAME "State: Disabled [saved]" 169 | echo >>$LOG_NAME "---" 170 | $SCRIPT_NAME log >>$LOG_NAME 171 | 172 | # Enabled/saved 173 | $SCRIPT_NAME enable >/dev/null 174 | $SCRIPT_NAME enable-config >/dev/null 175 | sleep 3 176 | echo >>$LOG_NAME "State: Enabled [saved]" 177 | echo >>$LOG_NAME "---" 178 | $SCRIPT_NAME log >>$LOG_NAME 179 | 180 | echo "Finished! Log created at $LOG_NAME." 181 | exit 182 | fi 183 | 184 | if [ "$1" = "log" ]; then 185 | echo SCRIPT_VERSION=$SCRIPT_VERSION 186 | echo PA_LADSPA_PLUGIN=$PA_LADSPA_PLUGIN 187 | echo PA_LADSPA_LABEL=$PA_LADSPA_LABEL 188 | echo PA_LADSPA_PLUGIN_NAME=$PA_LADSPA_PLUGIN_NAME 189 | echo PA_CURRENT_PRESET=$PA_CURRENT_PRESET 190 | echo PA_EQUALIZER_STATUS=$PA_EQUALIZER_STATUS 191 | echo PA_EQUALIZER_PERSISTENCE=$PA_EQUALIZER_PERSISTENCE 192 | echo PA_NUM_LADSPA_INPUTS=$PA_NUM_LADSPA_INPUTS 193 | echo PA_LADSPA_CONTROLS=$PA_LADSPA_CONTROLS 194 | echo PA_LADSPA_INPUTS=$PA_LADSPA_INPUTS 195 | echo PA_CONTROL_MIN=$PA_CONTROL_MIN 196 | echo PA_CONTROL_MAX=$PA_CONTROL_MAX 197 | 198 | echo PA_MASTER_SINK=$PA_MASTER_SINK 199 | echo PA_LADSPA_SINK=$PA_LADSPA_SINK 200 | echo PA_CURRENT_SINK=$PA_CURRENT_SINK 201 | echo PA_CURRENT_MUTE=$PA_CURRENT_MUTE 202 | echo PA_CURRENT_VOLUME=$PA_CURRENT_VOLUME 203 | echo PA_REAL_VOLUME=$PA_REAL_VOLUME 204 | echo PA_PREAMP=$PA_PREAMP 205 | echo PA_REAL_PREAMP=$PA_REAL_PREAMP 206 | 207 | if [ -f $HOME/.config/pulse/default.pa ]; then 208 | tail -n7 $HOME/.config/pulse/default.pa 209 | fi 210 | 211 | echo "---" 212 | echo "" 213 | exit 214 | fi 215 | 216 | # PyGTK Interface - Get Settings 217 | if [ "$1" = "interface.getsettings" ]; then 218 | # Convert commas into newlines and dump all settings to configuration file 219 | echo $PA_LADSPA_PLUGIN,$PA_LADSPA_LABEL,$PA_LADSPA_PLUGIN_NAME,$PA_PREAMP,$PA_CURRENT_PRESET,$PA_EQUALIZER_STATUS,$PA_EQUALIZER_PERSISTENCE,$PA_CONTROL_MIN,$PA_CONTROL_MAX,$PA_NUM_LADSPA_INPUTS,$PA_LADSPA_CONTROLS,$PA_LADSPA_INPUTS | sed 's/,/\n/g' >$CONFIG_NAME 220 | 221 | # Ensure that user preset directory exists 222 | if [ ! -d $PRESET_DIR1 ]; then 223 | mkdir $PRESET_DIR1 224 | fi 225 | 226 | # Generate list of available presets (system) 227 | ls -x1 $PRESET_DIR2/*.preset | sed "s|$PRESET_DIR2/||g" | sed 's/.preset//g' >$CONFIG_NAME.availablepresets.unsorted 228 | 229 | # Generate list of available presets (user) 230 | ls -x1 $PRESET_DIR1/*.preset | sed "s|$PRESET_DIR1/||g" | sed 's/.preset//g' >>$CONFIG_NAME.availablepresets.unsorted 231 | 232 | # Sort list 233 | sort $CONFIG_NAME.availablepresets.unsorted >$CONFIG_NAME.availablepresets 234 | rm $CONFIG_NAME.availablepresets.unsorted 235 | exit 236 | fi 237 | 238 | # Toggle equalizer on/off 239 | if [ "$1" = "toggle" -a "$PA_EQUALIZER_STATUS" = "1" ]; then 240 | $SCRIPT_NAME disable 241 | exit 242 | else if [ "$1" = "toggle" -a "$PA_EQUALIZER_STATUS" = "0" ]; then 243 | $SCRIPT_NAME enable 244 | exit 245 | fi 246 | fi 247 | 248 | if [ "$1" = "enable-config" ]; then 249 | # Enable the equalizer (if necessary) 250 | #$SCRIPT_NAME enable 251 | 252 | echo "Current operation: saving configuration (enable-config)" 253 | echo "-------------------------------------" 254 | 255 | # If equalizer configuration is already set, delete file 256 | if [ -f $HOME/.config/pulse/default.pa ]; then 257 | if [ "$(cat $HOME/.config/pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then 258 | echo "Equalizer definition detected in file '$HOME/.config/pulse/default.pa', deleting..." 259 | rm $HOME/.config/pulse/default.pa 260 | fi 261 | fi 262 | 263 | # Make a backup of configuration if necessary 264 | if [ -f $HOME/.config/pulse/default.pa ]; then 265 | echo "Found '$HOME/.config/pulse/default.pa', making a copy..." 266 | cp $HOME/.config/pulse/default.pa $HOME/.config/pulse/default.pa.noeq 267 | CFG_SOURCE_FILE="$HOME/.config/pulse/default.pa.noeq" 268 | fi 269 | 270 | # Decide which file to use as the configuration source 271 | if [ -f $HOME/.config/pulse/default.pa.noeq ]; then 272 | echo "Found '$HOME/.config/pulse/default.pa.noeq'..." 273 | CFG_SOURCE_FILE="$HOME/.config/pulse/default.pa.noeq" 274 | else 275 | CFG_SOURCE_FILE="/etc/pulse/default.pa" 276 | fi 277 | 278 | echo "Using configuration file '$CFG_SOURCE_FILE' as source..." 279 | 280 | # Modify module-stream-restore line to disable cached sinks 281 | cat $CFG_SOURCE_FILE | sed 's/load-module module-stream-restore/load-module module-stream-restore restore_device=false/g' >$HOME/.config/pulse/default.pa 282 | 283 | # Add module-ladspa-sink definition 284 | echo "" >>$HOME/.config/pulse/default.pa 285 | echo "### BEGIN: Equalized audio configuration" >>$HOME/.config/pulse/default.pa 286 | echo "### Generated from: $SCRIPT_NAME" >>$HOME/.config/pulse/default.pa 287 | echo ".nofail" >>$HOME/.config/pulse/default.pa 288 | echo "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK sink_master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS" >>$HOME/.config/pulse/default.pa 289 | 290 | # Set LADSPA sink as default sink & set appropriate master sink (preamp) volume 291 | echo "set-default-sink $PA_LADSPA_SINK" >>$HOME/.config/pulse/default.pa 292 | #echo "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" >>$HOME/.config/pulse/default.pa 293 | echo "set-sink-mute $PA_MASTER_SINK 0" >>$HOME/.config/pulse/default.pa 294 | echo ".endif" >>$HOME/.config/pulse/default.pa 295 | echo "### END: Equalized audio configuration" >>$HOME/.config/pulse/default.pa 296 | 297 | echo "Equalizer setting saved (enable-config)." 298 | echo "-------------------------------------" 299 | #$SCRIPT_NAME status 300 | exit 301 | fi 302 | 303 | if [ "$1" = "disable-config" ]; then 304 | # Disable the equalizer (if necessary) 305 | #$SCRIPT_NAME disable 306 | 307 | echo "Current operation: saving configuration (disable-config)" 308 | echo "-------------------------------------" 309 | 310 | # Move .noeq configuration file if it exists 311 | if [ -f $HOME/.config/pulse/default.pa.noeq ]; then 312 | echo "Found '$HOME/.config/pulse/default.pa.noeq', moving..." 313 | mv $HOME/.config/pulse/default.pa.noeq $HOME/.config/pulse/default.pa 314 | fi 315 | 316 | # If equalizer configuration is present, delete file 317 | if [ -f $HOME/.config/pulse/default.pa ]; then 318 | if [ "$(cat $HOME/.config/pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then 319 | echo "Equalizer definition detected, deleting '$HOME/.config/pulse/default.pa'..." 320 | rm $HOME/.config/pulse/default.pa 321 | fi 322 | fi 323 | 324 | echo "Equalizer setting saved (disable-config)." 325 | echo "-------------------------------------" 326 | #$SCRIPT_NAME status 327 | exit 328 | fi 329 | 330 | echo "PulseAudio Equalizer/LADSPA Processor $SCRIPT_VERSION" 331 | 332 | if [ "$1" = "disable" -o "$1" = "enable" ]; then 333 | echo "-------------------------------------" 334 | echo "Current operation: disabling equalizer" 335 | echo "-------------------------------------" 336 | echo -n >/tmp/eqcommands.sh 337 | 338 | # Unload & reload stream-restore module 339 | #echo "Unloading & reloading stream-restore module..." 340 | echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: ' | grep ' index: ' | sed 's/ index: //g')" 341 | echo >>/tmp/eqcommands.sh "load-module module-stream-restore" 342 | 343 | # Unload LADSPA sink module (if it is already loaded) 344 | echo "Unloading module-ladspa-sink..." 345 | echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: ' | grep ' index: ' | sed 's/ index: //g')" 346 | 347 | # Move active client sinks to ALSA sink 348 | echo "Moving active PulseAudio clients to ALSA sink ($PA_MASTER_SINK)..." 349 | echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /move-sink-input /g' | sed "s/$/ $PA_MASTER_SINK/g")" 350 | 351 | # Transfer current mute/sink volume to ALSA sink 352 | echo "Transferring current mute ($PA_CURRENT_MUTE) & volume ($PA_CURRENT_VOLUME%) to ALSA sink ($PA_MASTER_SINK)..." 353 | echo >>/tmp/eqcommands.sh "set-default-sink $PA_MASTER_SINK" 354 | echo >>/tmp/eqcommands.sh "set-sink-volume $PA_MASTER_SINK $PA_REAL_VOLUME" 355 | echo >>/tmp/eqcommands.sh "set-sink-mute $PA_MASTER_SINK $PA_CURRENT_MUTE" 356 | 357 | # Execute all queued commands (for potential speed benefit)... 358 | #pacmd /dev/null 359 | fi 360 | 361 | if [ "$1" = "enable" ]; then 362 | echo "-------------------------------------" 363 | echo "Current operation: enabling equalizer" 364 | echo "-------------------------------------" 365 | #echo -n >/tmp/eqcommands.sh 366 | 367 | # Unload & reload stream-restore module with restore_device option disabled (to ensure that previously cached per-client sinks are not used) 368 | echo "Unloading & reloading stream-restore module..." 369 | echo >>/tmp/eqcommands.sh "unload-module $(pacmd list | grep -B1 -m1 'name: ' | grep ' index: ' | sed 's/ index: //g')" 370 | echo >>/tmp/eqcommands.sh "load-module module-stream-restore restore_device=false" 371 | 372 | # Load LADSPA sink module 373 | echo "Loading module-ladspa-sink..." 374 | echo >>/tmp/eqcommands.sh "load-module module-ladspa-sink sink_name=$PA_LADSPA_SINK master=$PA_MASTER_SINK plugin=$PA_LADSPA_PLUGIN label=$PA_LADSPA_LABEL control=$PA_LADSPA_CONTROLS" 375 | 376 | # Transfer current sink mute/volume to LADSPA sink 377 | echo "Transferring current mute ($PA_CURRENT_MUTE) & volume ($PA_CURRENT_VOLUME%) to LADSPA sink ($PA_LADSPA_SINK)..." 378 | echo >>/tmp/eqcommands.sh "set-sink-volume $PA_LADSPA_SINK $PA_REAL_VOLUME" 379 | echo >>/tmp/eqcommands.sh "set-sink-mute $PA_LADSPA_SINK $PA_CURRENT_MUTE" 380 | 381 | # Unmute & set preamp level on ALSA sink (as LADSPA sink will act as primary volume control) 382 | echo "Setting ALSA sink ($PA_MASTER_SINK) preamp ("$PA_PREAMP"x)..." 383 | echo >>/tmp/eqcommands.sh "set-sink-volume $PA_MASTER_SINK $PA_REAL_PREAMP" 384 | echo >>/tmp/eqcommands.sh "set-sink-mute $PA_MASTER_SINK 0" 385 | 386 | # Set the LADSPA sink as the default 387 | echo "Setting LADSPA sink ($PA_LADSPA_SINK) as default sink..." 388 | echo >>/tmp/eqcommands.sh "set-default-sink $PA_LADSPA_SINK" 389 | 390 | # Move currently active client sinks to LADSPA sink 391 | echo "Moving active PulseAudio clients to LADSPA sink ($PA_LADSPA_SINK)..." 392 | echo >>/tmp/eqcommands.sh "$(pacmd "list-sink-inputs" | grep 'index: ' | sed 's/ index: /move-sink-input /g' | sed "s/$/ $PA_LADSPA_SINK/g")" 393 | 394 | # Execute all queued commands (for potential speed benefit)... 395 | pacmd /dev/null 396 | fi 397 | 398 | if [ "$1" = "disable" ]; then 399 | pacmd /dev/null 400 | fi 401 | 402 | if [ "$1" = "" -o "$1" = "-h" -o "$1" = "--help" ]; then 403 | echo -e "Usage: $SCRIPT_NAME [option]" 404 | echo -e "WARNING: This is for internal use by the pulseaudio-equalizer-gtk interface." 405 | echo -e " Use for debugging/troubleshooting purposes only." 406 | echo -e "" 407 | echo -e "Options (current session):" 408 | echo -e " enable\t\t enable the equalizer" 409 | echo -e " disable\t\t disable the equalizer" 410 | echo -e " toggle\t\t enable/disable the equalizer" 411 | echo -e "" 412 | echo -e "Options (persistent):" 413 | echo -e " enable-config\t\t enable the equalizer configuration" 414 | echo -e " disable-config\t disable the equalizer configuration" 415 | echo -e "" 416 | echo -e "Options (all):" 417 | echo -e " debug\t\t\t run equalizer diagnostics" 418 | echo -e " log\t\t\t show current equalizer log" 419 | echo -e " status\t\t show current equalizer status" 420 | echo -e "" 421 | exit 422 | fi 423 | 424 | if [ "$1" = "status" ]; then 425 | # Do nothing except show status 426 | echo -n 427 | fi 428 | 429 | # Refresh current sink status and display equalizer information 430 | PA_CURRENT_SINK=$(pacmd stat | grep "Default sink name" | sed 's/Default sink name: //g') 431 | if [ "$PA_CURRENT_SINK" = "$PA_LADSPA_SINK" ]; then 432 | echo "-------------------------------------" 433 | echo "Equalizer status: [enabled]" 434 | 435 | if [ -f $HOME/.config/pulse/default.pa ]; then 436 | if [ "$(cat $HOME/.config/pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then 437 | echo "Equalizer configuration status: [enabled]" 438 | else 439 | echo "Equalizer configuration status: [disabled]" 440 | fi 441 | else 442 | echo "Equalizer configuration status: [disabled]" 443 | fi 444 | 445 | echo "Equalizer plugin: [$PA_LADSPA_PLUGIN/$PA_LADSPA_LABEL]" 446 | echo "Equalizer control: [$PA_LADSPA_CONTROLS]" 447 | 448 | if [ -f $CONFIG_NAME ]; then 449 | echo "NOTE: Using user-customized settings from '$CONFIG_NAME'..." 450 | fi 451 | 452 | echo "-------------------------------------" 453 | else 454 | echo "-------------------------------------" 455 | echo "Equalizer status: [disabled]" 456 | 457 | if [ -f $HOME/.config/pulse/default.pa ]; then 458 | if [ "$(cat $HOME/.config/pulse/default.pa | grep -m1 "### BEGIN: Equalized audio configuration")" = "### BEGIN: Equalized audio configuration" ]; then 459 | echo "Equalizer configuration status: [enabled]" 460 | echo "Equalizer plugin: [$PA_LADSPA_PLUGIN/$PA_LADSPA_LABEL]" 461 | echo "Equalizer control: [$PA_LADSPA_CONTROLS]" 462 | 463 | if [ -f $CONFIG_NAME ]; then 464 | echo "NOTE: Using user-customized settings from '$CONFIG_NAME'..." 465 | fi 466 | 467 | else 468 | echo "Equalizer configuration status: [disabled]" 469 | fi 470 | else 471 | echo "Equalizer configuration status: [disabled]" 472 | fi 473 | 474 | echo "-------------------------------------" 475 | fi 476 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/equalizer.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | False 7 | True 8 | dialog 9 | Pulseaudio Equalizer 10 | 2024.07 11 | 12 | Copyleft (ɔ) 2018 - 2024 13 | by Luis Armando Medina Avitia. <lamedina@gmail.com> 14 | México 15 | 16 | A simple pulseaudio equalizer for Linux 17 | Enjoy this multiband equalizer to get a better sound 18 | when you use PulseAudio 19 | https://www.comoinstalarlinux.com/pulseaudio-equalizer-ladspa/ 20 | This is pulse audio equalizer, written and maintained by 21 | Luis Armando Medina Avitia <lamedina@gmail.com> 22 | Project's Homepage: http://comoinstalarlinux.com/pulseaudio-equalizer-ladspa 23 | 24 | Copyleft (ɔ) 2021, 2022, 2023, 2024 25 | by Luis Armando Medina Avitia. <lamedina@gmail.com> 26 | México 27 | 28 | This program is free software; you can redistribute it and/or modify 29 | it under the terms of the GNU General Public License version 3, as 30 | published by the Free Software Foundation. 31 | 32 | This program is distributed in the hope that it will be useful, 33 | but WITHOUT ANY WARRANTY; without even the implied warranty of 34 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 35 | GNU General Public License for more details. 36 | 37 | You should have received a copy of the GNU General Public License with 38 | the Debian GNU/Linux distribution in file /usr/share/common-licenses/GPL-3; 39 | if not, write to the Free Software Foundation, Inc., 40 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 41 | Luis Armando Medina Avitia https://github.com/larmedina75 42 | Filipe Laíns https://github.com/FFY00 43 | Conn O Griofa https://launchpad.net/~psyke83 44 | JuanJo Ciarlante https://github.com/jjo 45 | 46 | multimedia-volume-control 47 | 48 | 49 | 50 | 51 | False 52 | 10 53 | vertical 54 | 2 55 | 56 | 57 | False 58 | end 59 | 60 | 61 | False 62 | False 63 | -1 64 | 65 | 66 | 67 | 68 | 69 | 70 | False 71 | Warning 72 | dialog-information 73 | dialog 74 | center 75 | 76 | 77 | False 78 | vertical 79 | 2 80 | 81 | 82 | False 83 | end 84 | 85 | 86 | 87 | 88 | 89 | gtk-ok 90 | ok_button 91 | True 92 | True 93 | True 94 | True 95 | 96 | 97 | True 98 | True 99 | 1 100 | 101 | 102 | 103 | 104 | False 105 | False 106 | 0 107 | 108 | 109 | 110 | 111 | 112 | True 113 | False 114 | 115 | 116 | message 117 | True 118 | False 119 | 12 120 | 24 121 | label 122 | 123 | 124 | 1 125 | 1 126 | 127 | 128 | 129 | 130 | True 131 | False 132 | 12 133 | 12 134 | gtk-dialog-warning 135 | 136 | 137 | 0 138 | 1 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | False 165 | True 166 | 1 167 | 168 | 169 | 170 | 171 | 172 | button3 173 | 174 | 175 | 176 | False 177 | True 178 | dialog 179 | 180 | 181 | False 182 | 7 183 | 10 184 | vertical 185 | 2 186 | 187 | 188 | False 189 | end 190 | 191 | 192 | gtk-cancel 193 | True 194 | True 195 | True 196 | True 197 | 198 | 199 | 200 | True 201 | True 202 | 0 203 | 204 | 205 | 206 | 207 | gtk-save 208 | True 209 | True 210 | True 211 | True 212 | 213 | 214 | 215 | True 216 | True 217 | 1 218 | 219 | 220 | 221 | 222 | False 223 | False 224 | 0 225 | 226 | 227 | 228 | 229 | 230 | True 231 | False 232 | 233 | 234 | 100 235 | 80 236 | True 237 | False 238 | center 239 | center 240 | True 241 | True 242 | Preset name: 243 | 244 | 245 | 0 246 | 0 247 | 248 | 249 | 250 | 251 | True 252 | True 253 | center 254 | center 255 | False 256 | False 257 | 258 | 259 | 1 260 | 0 261 | 262 | 263 | 264 | 265 | False 266 | True 267 | 1 268 | 269 | 270 | 271 | 272 | 273 | button1 274 | button2 275 | 276 | 277 | 278 | True 279 | False 280 | document-open 281 | 282 | 283 | True 284 | False 285 | document-save 286 | 287 | 288 | True 289 | False 290 | document-open 291 | 292 | 690 | 691 | -------------------------------------------------------------------------------- /share/pulseaudio-equalizer/pulseaudio-equalizer.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python3 2 | # -*- coding: utf-8 -*- 3 | 4 | # PulseAudio Equalizer (PyGtk Interface) 5 | # version: 2022.08 6 | # 7 | # Maintainer: Luis Armando Medina Avitia 8 | # 9 | # Intended for use in conjunction with pulseaudio-equalizer script 10 | # 11 | # Author: Conn O'Griofa 12 | # Version: (see '/usr/pulseaudio-equalizer' script) 13 | # 14 | 15 | import gi 16 | gi.check_version('3.30') 17 | gi.require_version('Gtk', '3.0') 18 | from gi.repository import Gtk, Gio, GLib 19 | import os, sys 20 | import shutil 21 | import subprocess 22 | 23 | if 'PULSE_CONFIG_PATH' in os.environ: 24 | CONFIG_DIR = os.getenv('PULSE_CONFIG_PATH') 25 | elif 'XDG_CONFIG_HOME' in os.environ: 26 | CONFIG_DIR = os.path.join(os.getenv('XDG_CONFIG_HOME'), 'pulse') 27 | else: 28 | CONFIG_DIR = os.path.join(os.getenv('HOME'), '.config', 'pulse') 29 | CONFIG_FILE = os.path.join(CONFIG_DIR, 'equalizerrc') 30 | PRESETS_FILE = os.path.join(CONFIG_DIR, 'equalizerrc.availablepresets') 31 | USER_PRESET_DIR = os.path.join(CONFIG_DIR, 'presets') 32 | SYSTEM_PRESET_DIR = os.path.join('/usr/share/pulseaudio-equalizer', 'presets') 33 | PLUGIN_PRESENT = False 34 | if os.environ.get('GNOME_DESKTOP_SESSION_ID'): 35 | DESKTOP_ENVIRONMENT = "Gnome" 36 | else: 37 | DESKTOP_ENVIRONMENT = os.environ.get('DESKTOP_SESSION') 38 | 39 | if not os.path.exists('/usr/lib/ladspa/mbeq_1197.so'): 40 | print("Warning: Missing pluseaudio plug-in. Please install the swh-plugins package. ") 41 | else: 42 | PLUGIN_PRESENT = True 43 | 44 | print(CONFIG_DIR) 45 | print(SYSTEM_PRESET_DIR) 46 | print(DESKTOP_ENVIRONMENT) 47 | 48 | from urllib.request import url2pathname, urlparse, unquote 49 | from gi.repository import GdkPixbuf, Gdk 50 | 51 | configdir = os.getenv('HOME') + '/.config/pulse' 52 | eqconfig = configdir + '/equalizerrc' 53 | eqconfig2 = configdir + '/equalizerrc.test' 54 | eqpresets = eqconfig + '.availablepresets' 55 | presetdir1 = configdir + '/presets' 56 | presetdir2 = '/usr/share/pulseaudio-equalizer/presets' 57 | pulseaudio_scrip = "/home/lm/Dev/pulseaudio-equalizer-ladspa/bin/pulseaudio-equalizer" 58 | #pulseaudio_scrip = "/usr/bin/pulseaudio-equalizer" 59 | 60 | TARGET_TYPE_URI_LIST = 80 61 | 62 | def GetSettings(): 63 | global rawdata 64 | global rawpresets 65 | global ladspa_filename 66 | global ladspa_name 67 | global ladspa_label 68 | global preamp 69 | global num_ladspa_controls 70 | global ladspa_controls 71 | global ladspa_inputs 72 | global status 73 | global realstatus 74 | global persistence 75 | global preset 76 | global ranges 77 | global windowtitle 78 | global presetmatch 79 | global clearpreset 80 | global boxindex 81 | global headerbar 82 | global change_scale 83 | 84 | print(f"Getting settings...") 85 | 86 | if not os.path.exists(eqconfig): 87 | os.system(f'{pulseaudio_scrip} interface.getsettings') 88 | 89 | f = open(eqconfig, 'r') 90 | rawdata = f.read().split('\n') 91 | print(rawdata) 92 | f.close() 93 | 94 | rawpresets = {} 95 | f = open(eqpresets, 'r') 96 | rawpresets = f.read().split('\n') 97 | f.close() 98 | 99 | del rawpresets[len(rawpresets) - 1] 100 | 101 | rawpresets = list(set(rawpresets)) 102 | rawpresets.sort() 103 | 104 | ladspa_filename = str(rawdata[0]) 105 | ladspa_name = str(rawdata[1]) 106 | ladspa_label = str(rawdata[2]) 107 | preamp = rawdata[3] 108 | preset = str(rawdata[4]) 109 | status = int(rawdata[5]) 110 | persistence = int(rawdata[6]) 111 | ranges = rawdata[7:9] 112 | num_ladspa_controls = int(rawdata[9]) 113 | ladspa_controls = rawdata[10:10 + num_ladspa_controls] 114 | ladspa_inputs = rawdata[10 + num_ladspa_controls:10 + num_ladspa_controls + num_ladspa_controls] 115 | 116 | #print(f"getting status: {status} {rawdata[5]}") 117 | if status == 1: 118 | realstatus = 'Enabled' 119 | else: 120 | realstatus = 'Disabled' 121 | #print(f"getting realstatus: {realstatus}") 122 | 123 | windowtitle = 'PulseAudio ' + ladspa_label 124 | 125 | clearpreset = 1 126 | presetmatch = '' 127 | boxindex = -1 128 | 129 | for i in range(len(rawpresets)): 130 | if rawpresets[i] == preset: 131 | print('Match!') 132 | presetmatch = 1 133 | boxindex = i 134 | 135 | 136 | def ApplySettings(): 137 | global change_scale 138 | global init_stage 139 | global status 140 | if init_stage : 141 | return 142 | 143 | print('Applying settings...') 144 | f = open(eqconfig, 'w') 145 | del rawdata[:] 146 | rawdata.append(str(ladspa_filename)) 147 | rawdata.append(str(ladspa_name)) 148 | rawdata.append(str(ladspa_label)) 149 | rawdata.append(str(preamp)) 150 | rawdata.append(str(preset)) 151 | rawdata.append(str(status)) 152 | rawdata.append(str(persistence)) 153 | for i in range(2): 154 | rawdata.append(str(ranges[i])) 155 | rawdata.append(str(num_ladspa_controls)) 156 | for i in range(num_ladspa_controls): 157 | rawdata.append(str(ladspa_controls[i])) 158 | for i in range(num_ladspa_controls): 159 | rawdata.append(str(ladspa_inputs[i])) 160 | 161 | for i in rawdata: 162 | f.write(str(i) + '\n') 163 | 164 | f.close() 165 | 166 | os.system(f'{pulseaudio_scrip} interface.applysettings') 167 | change_scale = 0 168 | 169 | def FormatLabels(x): 170 | global c 171 | global suffix 172 | global whitespace1 173 | global whitespace2 174 | 175 | whitespace1 = '' 176 | whitespace2 = '' 177 | 178 | current_input = int(ladspa_inputs[x - 1]) 179 | if current_input < 99: 180 | a = current_input 181 | suffix = 'Hz' 182 | if current_input > 99 and current_input < 999: 183 | a = current_input 184 | suffix = 'Hz' 185 | if current_input > 999 and current_input < 9999: 186 | a = float(current_input) / 1000 187 | suffix = 'KHz' 188 | if current_input > 9999: 189 | a = float(current_input) / 1000 190 | suffix = 'KHz' 191 | 192 | # Filter out unnecessary ".0" from ladspa_inputs 193 | b = str(a) 194 | if b[-2:] == '.0': 195 | c = b[:-2] 196 | else: 197 | c = b 198 | 199 | # Add whitespace formatting to ensure text is centered 200 | if len(c) == 3 and len(suffix) == 2: 201 | whitespace2 = ' ' 202 | if len(c) < 4 and len(suffix) == 3: 203 | whitespace1 = ' ' 204 | if len(c) < 2 and len(suffix) == 3: 205 | whitespace1 = ' ' 206 | 207 | @Gtk.Template(filename='../share/pulseaudio-equalizer/equalizer.ui') 208 | #@Gtk.Template(filename='/usr/share/pulseaudio-equalizer/equalizer.ui') 209 | class Equalizer(Gtk.ApplicationWindow): 210 | __gtype_name__= "Equalizer" 211 | 212 | grid = Gtk.Template.Child() 213 | headerbarcheck: Gtk.CheckMenuItem = Gtk.Template.Child() 214 | savehdr: Gtk.Button = Gtk.Template.Child() 215 | deletehdr: Gtk.Button = Gtk.Template.Child() 216 | menuhdr: Gtk.MenuButton = Gtk.Template.Child() 217 | presetsbox = Gtk.Template.Child() 218 | activehdr: Gtk.Switch = Gtk.Template.Child() 219 | activestd: Gtk.Switch = Gtk.Template.Child() 220 | presetsbox1 = Gtk.Template.Child() 221 | about_headerbar: Gtk.ImageMenuItem = Gtk.Template.Child() 222 | 223 | new_preset: Gtk.Entry = Gtk.Template.Child('new_preset') 224 | 225 | menustd: Gtk.MenuBar = Gtk.Template.Child() 226 | actionbar: Gtk.ActionBar = Gtk.Template.Child() 227 | 228 | dialog_message: Gtk.Label = Gtk.Template.Child('message') 229 | 230 | window_about = Gtk.Template.Child('About') 231 | window_title: Gtk.Label = Gtk.Template.Child('title') 232 | window_save = Gtk.Template.Child('Save_dialog') 233 | 234 | window_dialog = Gtk.Template.Child('Message_dialog') 235 | 236 | 237 | def on_scale(self, widget, y): 238 | global ladspa_controls 239 | global preset 240 | global clearpreset 241 | global change_scale 242 | 243 | print("on_scale") 244 | newvalue = float(round(widget.get_value(), 1)) 245 | ladspa_controls[y] = newvalue 246 | 247 | change_scale = 1 248 | 249 | if clearpreset == 1: 250 | preset = '' 251 | presetmatch = '' 252 | self.presetsbox.get_child().set_text(preset) 253 | self.presetsbox1.get_child().set_text(preset) 254 | 255 | self.scalevalues[y].set_markup('' + str(float(ladspa_controls[y])) + '\ndB') 256 | 257 | if self.apply_event_source is not None: 258 | GLib.source_remove (self.apply_event_source); 259 | 260 | self.apply_event_source = GLib.timeout_add (500, self.on_apply_event) 261 | 262 | def on_apply_event(self): 263 | global change_scale 264 | global presetmatch 265 | #print("on_apply_event") 266 | #print(f"change_scale: {change_scale}") 267 | #print(f"presetmatch: {presetmatch}") 268 | ApplySettings() 269 | self.apply_event_source = None 270 | if change_scale == 1 and presetmatch == 1 : 271 | presetmatch = '' 272 | change_scale = 0 273 | #print(f"change_scale: {change_scale}") 274 | #print(f"presetmatch: {presetmatch}") 275 | 276 | return False 277 | 278 | 279 | @Gtk.Template.Callback() 280 | def on_headerbarcheck(self, widget, **_kwargs): 281 | global preset 282 | #print("on_headerbarcheck") 283 | assert self.headerbarcheck == widget 284 | #print(dir(widget)) 285 | if self.headerbarcheck.get_active() : 286 | #print('activo') 287 | self.savehdr.set_visible(True) 288 | self.deletehdr.set_visible(True) 289 | self.menuhdr.set_visible(True) 290 | self.presetsbox.set_visible(True) 291 | self.activehdr.set_visible(True) 292 | self.menustd.set_visible(False) 293 | self.actionbar.set_visible(False) 294 | self.about_headerbar.set_visible(True) 295 | self.window_title.set_visible(False) 296 | self.presetsbox.get_child().set_text(preset) 297 | else: 298 | #print('inactivo') 299 | self.savehdr.set_visible(False) 300 | self.deletehdr.set_visible(False) 301 | self.menuhdr.set_visible(False) 302 | self.presetsbox.set_visible(False) 303 | self.activehdr.set_visible(False) 304 | self.menustd.set_visible(True) 305 | self.actionbar.set_visible(True) 306 | self.about_headerbar.set_visible(False) 307 | self.window_title.set_visible(True) 308 | self.presetsbox1.get_child().set_text(preset) 309 | 310 | 311 | def update_preset(self): 312 | global preset 313 | global presetmatch 314 | global clearpreset 315 | global ladspa_filename 316 | global ladspa_name 317 | global ladspa_label 318 | global num_ladspa_controls 319 | global ladspa_controls 320 | global ladspa_inputs 321 | 322 | #print("update_preset") 323 | 324 | self.lookup_action('remove').set_enabled(False) 325 | #print("before check:",presetmatch) 326 | presetmatch = '' 327 | for i in range(len(rawpresets)): 328 | if rawpresets[i] == preset: 329 | print('Match!') 330 | presetmatch = 1 331 | 332 | #print('presetsbox',self.presetsbox.get_child().get_text()) 333 | #print('presetsbox1',self.presetsbox1.get_child().get_text()) 334 | #print("after check:",presetmatch) 335 | 336 | 337 | if presetmatch == 1: 338 | print(os.path.join(USER_PRESET_DIR, preset + '.preset')) 339 | print(os.path.join(SYSTEM_PRESET_DIR, preset + '.preset')) 340 | if os.path.isfile(os.path.join(USER_PRESET_DIR, preset + '.preset')): 341 | f = open(os.path.join(USER_PRESET_DIR, preset + '.preset'), 'r') 342 | rawdata = f.read().split('\n') 343 | f.close 344 | self.lookup_action('remove').set_enabled(True) 345 | elif os.path.isfile(os.path.join(SYSTEM_PRESET_DIR, preset + '.preset')): 346 | f = open(os.path.join(SYSTEM_PRESET_DIR, preset + '.preset'), 'r') 347 | rawdata = f.read().split('\n') 348 | f.close 349 | else: 350 | print("Can't find %s preset" % preset) 351 | 352 | ladspa_filename = str(rawdata[0]) 353 | ladspa_name = str(rawdata[1]) 354 | ladspa_label = str(rawdata[2]) 355 | preset = str(rawdata[4]) 356 | num_ladspa_controls = int(rawdata[5]) 357 | ladspa_controls = rawdata[6:6 + num_ladspa_controls] 358 | ladspa_inputs = rawdata[6 + num_ladspa_controls:6 + num_ladspa_controls + num_ladspa_controls] 359 | 360 | clearpreset = '' 361 | for i in range(num_ladspa_controls): 362 | self.scales[i].set_value(float(ladspa_controls[i])) 363 | self.labels[i].set_frequency(ladspa_inputs[i]) 364 | self.scalevalues[i].set_markup('' + str(float(ladspa_controls[i])) + '\ndB') 365 | 366 | # Set preset again due to interference from scale modifications 367 | preset = str(rawdata[4]) 368 | clearpreset = 1 369 | if self.headerbarcheck.get_active() : 370 | self.presetsbox.get_child().set_text(preset) 371 | else: 372 | self.presetsbox1.get_child().set_text(preset) 373 | #ApplySettings() 374 | 375 | #self.lookup_action('save').set_enabled(False) 376 | else: 377 | pass 378 | #self.lookup_action('save').set_enabled(preset != '') 379 | 380 | 381 | @Gtk.Template.Callback() 382 | def on_presetsbox(self, widget): 383 | global preset 384 | global clearpreset 385 | global presetmatch 386 | global change_scale 387 | 388 | #print("on_presetsbox") 389 | presetmatch = '' 390 | 391 | #print(f"preset: {preset}") 392 | #print(f"clearpreset: {clearpreset}") 393 | #print(f"presetmatch: {presetmatch}") 394 | 395 | active_hdr = self.headerbarcheck.get_active() 396 | #print(f"header: {active_hdr}") 397 | 398 | if self.headerbarcheck.get_active() : 399 | if not change_scale : 400 | if len(self.presetsbox.get_child().get_text()) > 0 : 401 | preset = self.presetsbox.get_child().get_text() 402 | #self.presetsbox1.get_child().set_text(preset) 403 | self.update_preset() 404 | change_scale = 0 405 | else: 406 | if not change_scale : 407 | if len(self.presetsbox1.get_child().get_text()) > 0 : 408 | preset = self.presetsbox1.get_child().get_text() 409 | #self.presetsbox.get_child().set_text(preset) 410 | self.update_preset() 411 | change_scale = 0 412 | 413 | def on_resetsettings(self, action=None, param=None): 414 | print('Resetting to defaults...') 415 | os.system(f'{pulseaudio_scrip} interface.resetsettings') 416 | GetSettings() 417 | 418 | self.lookup_action('eqenabled').set_state(GLib.Variant('b', status)) 419 | Gio.Application.get_default().lookup_action('keepsettings').set_state(GLib.Variant('b', persistence)) 420 | self.presetsbox.get_child().set_text(preset) 421 | self.presetsbox1.get_child().set_text(preset) 422 | for i in range(num_ladspa_controls): 423 | self.scales[i].set_value(float(ladspa_controls[i])) 424 | self.labels[i].set_frequency(ladspa_inputs[i]) 425 | self.scalevalues[i].set_markup('' + str(float(ladspa_controls[i])) + '\ndB') 426 | 427 | def on_savepreset(self, action, param): 428 | global preset 429 | global presetmatch 430 | global presetmatch1 431 | 432 | print("on_savepreset") 433 | 434 | preset = self.presetsbox.get_child().get_text() 435 | if preset == '' or presetmatch == 1: 436 | print('Invalid preset name') 437 | else: 438 | f = open(os.path.join(USER_PRESET_DIR, preset + '.preset'), 'w') 439 | 440 | del rawdata[:] 441 | rawdata.append(str(ladspa_filename)) 442 | rawdata.append(str(ladspa_name)) 443 | rawdata.append(str(ladspa_label)) 444 | rawdata.append('') 445 | rawdata.append(str(preset)) 446 | rawdata.append(str(num_ladspa_controls)) 447 | for i in range(num_ladspa_controls): 448 | rawdata.append(str(ladspa_controls[i])) 449 | for i in range(num_ladspa_controls): 450 | rawdata.append(str(ladspa_inputs[i])) 451 | 452 | for i in rawdata: 453 | f.write(str(i) + '\n') 454 | f.close() 455 | 456 | # Clear preset list from ComboBox 457 | self.presetsbox.remove_all() 458 | self.presetsbox1.remove_all() 459 | 460 | # Apply settings (which will save new preset as default) 461 | ApplySettings() 462 | 463 | # Refresh (and therefore, sort) preset list 464 | os.system(f'{pulseaudio_scrip} interface.getsettings') 465 | GetSettings() 466 | 467 | # Repopulate preset list into ComboBox 468 | for i in range(len(rawpresets)): 469 | self.presetsbox.append_text(rawpresets[i]) 470 | self.presetsbox1.append_text(rawpresets[i]) 471 | 472 | action.set_enabled(False) 473 | self.lookup_action('remove').set_enabled(True) 474 | 475 | def on_eqenabled(self, action, state): 476 | global status 477 | print(f"status: {status}") 478 | print(f"statate: {state}") 479 | status = int(state.get_boolean()) 480 | ApplySettings() 481 | action.set_state(state) 482 | 483 | def on_eqenabledstd(self, action, state): 484 | global status 485 | print(f"status std: {status}") 486 | print(f"statate std: {state}") 487 | status = int(state.get_boolean()) 488 | ApplySettings() 489 | action.set_state(state) 490 | 491 | def on_removepreset(self, action, param): 492 | global preset 493 | os.remove(os.path.join(USER_PRESET_DIR, preset + '.preset')) 494 | 495 | self.presetsbox.get_child().set_text('') 496 | self.presetsbox1.get_child().set_text('') 497 | 498 | # Clear preset list from ComboBox 499 | self.presetsbox.remove_all() 500 | self.presetsbox1.remove_all() 501 | 502 | # Refresh (and therefore, sort) preset list 503 | GetSettings() 504 | 505 | # Repopulate preset list into ComboBox 506 | for i in range(len(rawpresets)): 507 | self.presetsbox.append_text(rawpresets[i]) 508 | self.presetsbox1.append_text(rawpresets[i]) 509 | 510 | preset = '' 511 | # Apply settings 512 | ApplySettings() 513 | 514 | action.set_enabled(False) 515 | 516 | @Gtk.Template.Callback() 517 | def on_delete(self, widget): 518 | global preset 519 | if os.path.exists(os.path.join(USER_PRESET_DIR, preset + '.preset')): 520 | os.remove(os.path.join(USER_PRESET_DIR, preset + '.preset')) 521 | 522 | self.presetsbox.get_child().set_text('') 523 | self.presetsbox1.get_child().set_text('') 524 | 525 | # Clear preset list from ComboBox 526 | self.presetsbox.remove_all() 527 | self.presetsbox1.remove_all() 528 | 529 | # Apply settings (which will save new preset as default) 530 | ApplySettings() 531 | 532 | # Refresh (and therefore, sort) preset list 533 | os.system(f'{pulseaudio_scrip} interface.getsettings') 534 | GetSettings() 535 | 536 | # Repopulate preset list into ComboBox 537 | for i in range(len(rawpresets)): 538 | self.presetsbox.append_text(rawpresets[i]) 539 | self.presetsbox1.append_text(rawpresets[i]) 540 | 541 | preset = '' 542 | else: 543 | pass # show dialog window "user preset does not exist." 544 | 545 | @Gtk.Template.Callback() 546 | def on_about_activate(self, widget): 547 | result = self.window_about.run() 548 | if result == -4 : 549 | self.window_about.hide() 550 | 551 | @Gtk.Template.Callback() 552 | def on_about_close(self, widget): 553 | self.window_about.hide() 554 | 555 | @Gtk.Template.Callback() 556 | def on_save(self, widget): 557 | global preset 558 | global presetmatch 559 | global presetmatch1 560 | 561 | self.new_preset.set_text('') 562 | result = self.window_save.run() 563 | print(result) 564 | if result == -6 or result == -4 : 565 | self.window_save.hide() 566 | elif result == Gtk.ResponseType.ACCEPT : 567 | #save new preset 568 | 569 | preset = self.new_preset.get_text() 570 | 571 | print(preset) 572 | print(presetmatch) 573 | 574 | if preset == '' or presetmatch == 1: 575 | print('Invalid preset name') 576 | else: 577 | f = open(os.path.join(USER_PRESET_DIR, preset + '.preset'), 'w') 578 | 579 | del rawdata[:] 580 | rawdata.append(str(ladspa_filename)) 581 | rawdata.append(str(ladspa_name)) 582 | rawdata.append(str(ladspa_label)) 583 | rawdata.append('') 584 | rawdata.append(str(preset)) 585 | rawdata.append(str(num_ladspa_controls)) 586 | for i in range(num_ladspa_controls): 587 | rawdata.append(str(ladspa_controls[i])) 588 | for i in range(num_ladspa_controls): 589 | rawdata.append(str(ladspa_inputs[i])) 590 | 591 | for i in rawdata: 592 | f.write(str(i) + '\n') 593 | f.close() 594 | 595 | # Clear preset list from ComboBox 596 | self.presetsbox.remove_all() 597 | self.presetsbox1.remove_all() 598 | 599 | # Apply settings (which will save new preset as default) 600 | ApplySettings() 601 | 602 | # Refresh (and therefore, sort) preset list 603 | os.system(f'{pulseaudio_scrip} interface.getsettings') 604 | GetSettings() 605 | 606 | # Repopulate preset list into ComboBox 607 | for i in range(len(rawpresets)): 608 | self.presetsbox.append_text(rawpresets[i]) 609 | self.presetsbox1.append_text(rawpresets[i]) 610 | 611 | #action.set_enabled(False) 612 | self.lookup_action('remove').set_enabled(True) 613 | 614 | if self.headerbarcheck.get_active() : 615 | self.presetsbox.get_child().set_text(preset) 616 | else: 617 | self.presetsbox1.get_child().set_text(preset) 618 | presetmatch = 1 619 | 620 | self.window_save.hide() 621 | 622 | @Gtk.Template.Callback() 623 | def on_save_close(self, widget): 624 | self.window_save.hide() 625 | 626 | @Gtk.Template.Callback() 627 | def on_importpreset(self, widget): 628 | global preset 629 | global presets 630 | global rawpresets 631 | 632 | dialog = Gtk.FileChooserDialog(title='Import Preset...', 633 | parent=None, 634 | action=Gtk.FileChooserAction.OPEN) 635 | dialog.add_buttons(Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL) 636 | dialog.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK) 637 | dialog.set_default_response(Gtk.ResponseType.OK) 638 | 639 | filter = Gtk.FileFilter() 640 | filter.set_name('Preset files') 641 | filter.add_pattern('*.preset') 642 | dialog.add_filter(filter) 643 | dialog.set_current_folder(presetdir1) 644 | dialog.show() 645 | 646 | response = dialog.run() 647 | if response == Gtk.ResponseType.OK: 648 | filename = dialog.get_filename() 649 | path_and_name = os.path.split(filename) 650 | name = path_and_name[1] 651 | 652 | print('Importing preset:',path_and_name) 653 | 654 | if os.path.isfile(path_and_name[0] + '/' + path_and_name[1]): 655 | f = open(path_and_name[0] + '/' + path_and_name[1], 'r') 656 | rawdata = f.read().split('\n') 657 | f.close 658 | 659 | if rawdata[0] == "mbeq_1197" and rawdata[1] == "mbeq" and rawdata[2] == "Multiband EQ" : 660 | os.system('cp -f "'+path_and_name[0] + '/' + path_and_name[1] + '" ' +presetdir1 ) 661 | print("Preset imported successfully.") 662 | 663 | # Refresh (and therefore, sort) preset list 664 | os.system(f'{pulseaudio_scrip} interface.getsettings') 665 | GetSettings() 666 | 667 | # Repopulate preset list into ComboBox 668 | model0 = self.presetsbox.get_model() 669 | #self.presetsbox.set_model(None) 670 | self.presetsbox.remove_all() 671 | model0.clear() 672 | model1 = self.presetsbox1.get_model() 673 | #self.presetsbox1.set_model(None) 674 | self.presetsbox1 675 | model1.clear() 676 | 677 | boxindex = 0 678 | for i in range(len(rawpresets)): 679 | print(i) 680 | #model0.append( [rawpresets[i]] ) 681 | #model1.append( [rawpresets[i]] ) 682 | self.presetsbox.append_text(rawpresets[i]) 683 | self.presetsbox1.append_text(rawpresets[i]) 684 | if rawpresets[i] == rawdata[4]: 685 | boxindex = i 686 | #self.presetsbox.set_model(model0) 687 | #self.presetsbox1.set_model(model1) 688 | self.presetsbox.set_active(boxindex) 689 | self.presetsbox1.set_active(boxindex) 690 | 691 | dialog.destroy() 692 | 693 | @Gtk.Template.Callback() 694 | def on_exportpreset(self, widget): 695 | global preset 696 | global presets 697 | print('on_exportpreset') 698 | dialog = Gtk.FileChooserDialog(title='Export Preset...', 699 | parent=None, 700 | action=Gtk.FileChooserAction.SAVE) 701 | dialog.add_buttons(Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL) 702 | dialog.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK) 703 | dialog.set_default_response(Gtk.ResponseType.OK) 704 | 705 | if len(str(preset)) > 0: 706 | dialog.set_current_name(str(preset)+'.preset') 707 | 708 | filter = Gtk.FileFilter() 709 | filter.set_name('Preset files') 710 | filter.add_pattern('*.preset') 711 | dialog.add_filter(filter) 712 | dialog.set_current_folder(presetdir1) 713 | dialog.show() 714 | 715 | response = dialog.run() 716 | print(response) 717 | if response == Gtk.ResponseType.OK: 718 | filename = dialog.get_filename() 719 | path_and_name = os.path.split(filename) 720 | 721 | print('Export to: ',path_and_name) 722 | 723 | # Verify filename has a .preset extension 724 | name = path_and_name[1] 725 | if not '.preset' in path_and_name[1] : 726 | name = path_and_name[1] + '.preset' 727 | 728 | # Assign a name based on filename if preset is empty string 729 | if len(str(preset)) < 1 : 730 | preset = path_and_name[1] 731 | 732 | 733 | # Save current configration to export as a .preset file 734 | f = open(path_and_name[0] + '/' + name , 'w') 735 | 736 | del rawdata[:] 737 | rawdata.append(str(ladspa_filename)) 738 | rawdata.append(str(ladspa_name)) 739 | rawdata.append(str(ladspa_label)) 740 | rawdata.append(str(preamp)) 741 | rawdata.append(str(preset)) 742 | rawdata.append(str(num_ladspa_controls)) 743 | for i in range(num_ladspa_controls): 744 | rawdata.append(str(ladspa_controls[i])) 745 | for i in range(num_ladspa_controls): 746 | rawdata.append(str(ladspa_inputs[i])) 747 | 748 | for i in rawdata: 749 | f.write(str(i) + '\n') 750 | f.close() 751 | 752 | dialog.destroy() 753 | 754 | @Gtk.Template.Callback() 755 | def on_exportallpresets(self, widget): 756 | global preset 757 | global presets 758 | global presetdir1 759 | 760 | print('on_exportallpresets') 761 | dialog = Gtk.FileChooserDialog(title='Export All Presets...', 762 | parent=None, 763 | action=Gtk.FileChooserAction.SELECT_FOLDER) 764 | dialog.add_buttons(Gtk.STOCK_CANCEL,Gtk.ResponseType.CANCEL) 765 | dialog.add_buttons(Gtk.STOCK_OK, Gtk.ResponseType.OK) 766 | dialog.set_default_response(Gtk.ResponseType.OK) 767 | 768 | xdg_bin = shutil.which('xdg-user-dir') 769 | process = subprocess.run([xdg_bin, 'DOWNLOAD'], stdout=subprocess.PIPE) 770 | download_path = process.stdout.strip().decode() 771 | 772 | dialog.set_current_folder(download_path) 773 | dialog.show() 774 | 775 | response = dialog.run() 776 | print(response) 777 | 778 | if response == Gtk.ResponseType.OK: 779 | export_path = dialog.get_filename() 780 | print(export_path) 781 | shutil.copytree(presetdir1, export_path, symlinks=False, ignore=None, ignore_dangling_symlinks=False, dirs_exist_ok=True) 782 | 783 | dialog.destroy() 784 | 785 | def on_drag_data_received(self, widget, context, x, y, selection, target_type, timestamp): 786 | global preset 787 | global presets 788 | global rawpresets 789 | 790 | if target_type == TARGET_TYPE_URI_LIST: 791 | uris = selection.get_uris() 792 | print( 'uris', uris ) 793 | 794 | for uri in uris: 795 | varPathRaw = urlparse(uri).path 796 | varPathDecode = unquote(varPathRaw) 797 | 798 | if os.path.isfile(varPathDecode): # is it file? 799 | print('opening file ',varPathDecode) 800 | f = open(varPathDecode, 'r') 801 | rawdata = f.read().split('\n') 802 | f.close 803 | print(rawdata) 804 | 805 | if rawdata[0] == "mbeq_1197" and rawdata[1] == "mbeq" and rawdata[2] == "Multiband EQ" : 806 | os.system('cp -f "' + varPathDecode + '" ' + presetdir1 ) 807 | print("Preset imported successfully.", 'cp -f "' + varPathDecode + '" ' + presetdir1 ) 808 | 809 | # Refresh (and therefore, sort) preset list 810 | os.system(f'{pulseaudio_scrip} interface.getsettings') 811 | GetSettings() 812 | 813 | # Repopulate preset list into ComboBox 814 | model0 = self.presetsbox.get_model() 815 | #self.presetsbox.set_model(None) 816 | self.presetsbox.remove_all() 817 | model0.clear() 818 | model1 = self.presetsbox1.get_model() 819 | #self.presetsbox1.set_model(None) 820 | self.presetsbox1 821 | model1.clear() 822 | 823 | boxindex = 0 824 | for i in range(len(rawpresets)): 825 | print(i) 826 | #model0.append( [rawpresets[i]] ) 827 | #model1.append( [rawpresets[i]] ) 828 | self.presetsbox.append_text(rawpresets[i]) 829 | self.presetsbox1.append_text(rawpresets[i]) 830 | if rawpresets[i] == rawdata[4]: 831 | boxindex = i 832 | #self.presetsbox.set_model(model0) 833 | #self.presetsbox1.set_model(model1) 834 | self.presetsbox.set_active(boxindex) 835 | self.presetsbox1.set_active(boxindex) 836 | 837 | else: 838 | print('file ',varPathDecode,'not found') 839 | 840 | 841 | def __init__(self, *args, **kwargs): 842 | super(Equalizer, self).__init__(*args, **kwargs) 843 | global headerbar 844 | global change_scale 845 | global status 846 | #GetSettings() 847 | 848 | self.apply_event_source = None 849 | 850 | headerbar = 0 851 | change_scale = 0 852 | if headerbar : 853 | #print('activo') 854 | self.savehdr.set_visible(True) 855 | self.deletehdr.set_visible(True) 856 | self.menuhdr.set_visible(True) 857 | self.presetsbox.set_visible(True) 858 | self.activehdr.set_visible(True) 859 | self.menustd.set_visible(False) 860 | self.actionbar.set_visible(False) 861 | self.about_headerbar.set_visible(True) 862 | self.window_title.set_visible(False) 863 | else: 864 | #print('inactivo') 865 | self.savehdr.set_visible(False) 866 | self.deletehdr.set_visible(False) 867 | self.menuhdr.set_visible(False) 868 | self.presetsbox.set_visible(False) 869 | self.activehdr.set_visible(False) 870 | self.menustd.set_visible(True) 871 | self.actionbar.set_visible(True) 872 | self.about_headerbar.set_visible(False) 873 | self.window_title.set_visible(True) 874 | 875 | self.activehdr.set_state(status == 1) 876 | self.activestd.set_state(status == 1) 877 | 878 | # Equalizer bands 879 | global scale 880 | self.scales = {} 881 | self.labels = {} 882 | self.scalevalues = {} 883 | for x in range(num_ladspa_controls): 884 | scale = Gtk.Scale(orientation=Gtk.Orientation.VERTICAL, 885 | draw_value=False, inverted=True, digits=1, 886 | expand=True, visible=True) 887 | self.scales[x] = scale 888 | scale.set_range(float(ranges[0]), float(ranges[1])) 889 | scale.set_increments(1, 0.1) 890 | scale.set_size_request(35, 200) 891 | scale.set_value(float(ladspa_controls[x])) 892 | scale.connect('value-changed', self.on_scale, x) 893 | label = FrequencyLabel(frequency = ladspa_inputs[x]) 894 | self.labels[x] = label 895 | scalevalue = Gtk.Label(visible=True, use_markup=True, 896 | label='' + str(scale.get_value()) + '\ndB') 897 | self.scalevalues[x] = scalevalue 898 | self.grid.attach(label, x, 0, 1, 1) 899 | self.grid.attach(scale, x, 1, 1, 2) 900 | self.grid.attach(scalevalue, x, 3, 1, 1) 901 | 902 | self.connect('drag_data_received', self.on_drag_data_received) 903 | self.drag_dest_set( Gtk.DestDefaults.MOTION| 904 | Gtk.DestDefaults.HIGHLIGHT | Gtk.DestDefaults.DROP, 905 | [Gtk.TargetEntry.new("text/uri-list", 0, 80)], 906 | Gdk.DragAction.COPY) 907 | 908 | action = Gio.SimpleAction.new('save', None) 909 | #action.set_enabled(False) 910 | action.connect('activate', self.on_savepreset) 911 | self.add_action(action) 912 | 913 | action = Gio.SimpleAction.new('on_importpreset', None) 914 | action.connect('activate', self.on_importpreset) 915 | self.add_action(action) 916 | 917 | action = Gio.SimpleAction.new('on_exportpreset', None) 918 | action.connect('activate', self.on_exportpreset) 919 | self.add_action(action) 920 | 921 | action = Gio.SimpleAction.new('on_exportallpresets', None) 922 | action.connect('activate', self.on_exportallpresets) 923 | self.add_action(action) 924 | 925 | action = Gio.SimpleAction.new('on_save', None) 926 | action.connect('activate', self.on_save) 927 | self.add_action(action) 928 | 929 | action = Gio.SimpleAction.new('save_close', None) 930 | action.connect('activate', self.on_save_close) 931 | self.add_action(action) 932 | 933 | action = Gio.SimpleAction.new('remove', None) 934 | action.set_enabled(False) 935 | action.connect('activate', self.on_removepreset) 936 | self.add_action(action) 937 | 938 | action = Gio.SimpleAction.new('on_delete', None) 939 | action.connect('activate', self.on_delete) 940 | self.add_action(action) 941 | 942 | self.presetsbox.get_child().set_text(preset) 943 | self.presetsbox1.get_child().set_text(preset) 944 | for i in range(len(rawpresets)): 945 | self.presetsbox.append_text(rawpresets[i]) 946 | self.presetsbox1.append_text(rawpresets[i]) 947 | 948 | action = Gio.SimpleAction.new_stateful('eqenabled', None, 949 | GLib.Variant('b', status)) 950 | action.connect('change-state', self.on_eqenabled) 951 | self.add_action(action) 952 | 953 | action = Gio.SimpleAction.new_stateful('eqenabledstd', None, 954 | GLib.Variant('b', status)) 955 | action.connect('change-state', self.on_eqenabled) 956 | self.add_action(action) 957 | 958 | action = Gio.SimpleAction.new('about', None) 959 | action.connect('activate', self.on_about_activate) 960 | self.add_action(action) 961 | 962 | action = Gio.SimpleAction.new('about_close', None) 963 | action.connect('activate', self.on_about_close) 964 | self.add_action(action) 965 | 966 | self.show() 967 | 968 | if not PLUGIN_PRESENT : 969 | # when swh plug-ins are not installed a warning message is displayed 970 | self.dialog_message.title = "Warning" 971 | self.dialog_message.set_text("Warning: Missing pluseaudio plug-in. Please install the swh-plugins package.") 972 | result = self.window_dialog.run() 973 | if result == -3 : 974 | self.window_dialog.hide() 975 | 976 | 977 | class FrequencyLabel(Gtk.Label): 978 | def __init__(self, frequency=None): 979 | super(FrequencyLabel, self).__init__(visible=True, use_markup=True, 980 | justify=Gtk.Justification.CENTER) 981 | if frequency is not None: 982 | self.set_frequency(frequency) 983 | 984 | def set_frequency(self, frequency): 985 | frequency = float(frequency) 986 | suffix = 'Hz' 987 | 988 | if frequency > 999: 989 | frequency = frequency / 1000 990 | suffix = 'KHz' 991 | 992 | self.set_label('{0:g}\n{1}'.format(frequency, suffix)) 993 | 994 | 995 | class Application(Gtk.Application): 996 | 997 | def __init__(self, *args, **kwargs): 998 | super(Application, self).__init__(*args, 999 | application_id='com.github.pulseaudio-equalizer-ladspa.Equalizer', 1000 | resource_base_path='/com/github/pulseaudio-equalizer-ladspa/Equalizer', 1001 | **kwargs) 1002 | 1003 | self.window = None 1004 | 1005 | def do_startup(self): 1006 | global init_stage 1007 | init_stage = 1 1008 | 1009 | Gtk.Application.do_startup(self) 1010 | GetSettings() 1011 | #os.system('cat /home/lm/.config/pulse/equalizerrc') 1012 | 1013 | 1014 | self.window = Equalizer(application=self) 1015 | 1016 | action = Gio.SimpleAction.new('resetsettings', None) 1017 | action.connect('activate', self.window.on_resetsettings) 1018 | self.add_action(action) 1019 | 1020 | global persistence 1021 | action = Gio.SimpleAction.new_stateful('keepsettings', None, 1022 | GLib.Variant('b', persistence)) 1023 | action.connect('change-state', self.on_keepsettings) 1024 | self.add_action(action) 1025 | 1026 | action = Gio.SimpleAction.new('quit', None) 1027 | action.connect('activate', self.on_quit) 1028 | self.add_action(action) 1029 | 1030 | action = Gio.SimpleAction.new('headerbarcheck', None) 1031 | action.connect('activate', self.window.on_headerbarcheck) 1032 | self.add_action(action) 1033 | 1034 | def do_activate(self): 1035 | global init_stage 1036 | if not self.window: 1037 | self.window = Equalizer(application=self) 1038 | 1039 | self.window.present() 1040 | init_stage = 0 1041 | 1042 | def on_keepsettings(self, action, state): 1043 | global persistence 1044 | global init_stage 1045 | if init_stage : 1046 | return 1047 | persistence = int(state.get_boolean()) 1048 | ApplySettings() 1049 | action.set_state(state) 1050 | 1051 | def on_quit(self, action, param): 1052 | Gio.Application.get_default().quit() 1053 | 1054 | #os.system('cat /home/lm/.config/pulse/equalizerrc') 1055 | app = Application() 1056 | app.run(sys.argv) --------------------------------------------------------------------------------