Volume via GPIO

Hi, I have a HifiBerry AMP and wonder if it is possible to control volume via GPIO?
What I need is:
Volume up
Volume down
Mute
Mute LED (Out)

EDIT:
This works accept the mute function (don’t know why).
And it also requires u to install extra packages…

#!/bin/python

from gpiozero import Button
from signal import pause
from subprocess import Popen

def increase_volume():
Popen([‘amixer’, ‘-c’, ‘1’, ‘sset’, ‘Master’, ‘1+’, ‘-q’])

def decrease_volume():
Popen([‘amixer’, ‘-c’, ‘1’, ‘sset’, ‘Master’, ‘1-’, ‘-q’])

def mute_volume():
Popen([‘amixer’, ‘-c’, ‘1’, ‘sset’, ‘Master’, ‘toggle’, ‘-q’])

button_up = Button(23, pull_up = False)
button_up.when_pressed = increase_volume
button_down = Button(24, pull_up = False)
button_down.when_pressed = decrease_volume
button_mute = Button(25, pull_up = False)
button_mute.when_held = mute_volume

pause()

Hi, below python script works.
But it need additional packages to be installed.

#!/bin/python

from gpiozero import Button, LED
from signal import pause
from subprocess import Popen, PIPE

p1 = Popen(['amixer', '-c', '1', 'sget', 'Master'],stdout=PIPE)
p2 = Popen(['grep', 'Mono:'],stdin=p1.stdout,stdout=PIPE)
p1.stdout.close()
p3 = Popen(['awk', '{ print $2 } '], stdin=p2.stdout, stdout=PIPE)
vol = str(p3.communicate()[0])[2:-3]
print('Starting... Vol at:')
print(vol)


Mute_LED = LED(8)
Red_LED = LED(15)
White_LED = LED(14)

White_LED.on()
if vol == '0':
        Mute_LED.on()
else:
        Mute_LED.off()

def increase_volume():
        Popen(['amixer', '-c', '1', 'sset', 'Master', '1%+', '-q'])

def decrease_volume():
        Popen(['amixer', '-c', '1', 'sset', 'Master', '1%-', '-q'])

def mute_volume():
        global vol
        Mute_LED.toggle()
        if Mute_LED.is_active == True:
                p1 = Popen(['amixer', '-c', '1', 'sget', 'Master'],stdout=PIPE)
                p2 = Popen(['grep', 'Mono:'],stdin=p1.stdout,stdout=PIPE)
                p1.stdout.close()
                p3 = Popen(['awk', '{ print $2 } '], stdin=p2.stdout, stdout=PIPE)
                vol = str(p3.communicate()[0])[2:-3]
                Popen(['amixer', '-c', '1', 'sset', 'Master', '0%', '-q'])
        else:
                 Popen(['amixer', '-c', '1', 'sset', 'Master', vol, '-q'])

button_up = Button(23, pull_up = True)
button_up.when_pressed = increase_volume
button_down = Button(24, pull_up = True)
button_down.when_pressed = decrease_volume
button_mute = Button(25, pull_up = True)
button_mute.when_pressed = mute_volume

pause()