Please do not post a support request without first reading and following the advice in

[SOLVED] Audio gestion with 2 physical buttons on GPIO

  • The subject are already open, but it's not what I search.
    or I don't understand the answers (possibly)

    Hello, (sorry i'm french and i've a basic level in english, please when you reply to this post, simplified your english, thanks)

    I've a project in progress, and a part of this project consist to up and down the volume of retropie (alsamixer).
    I see the parameter to up/down volume in the settings, but i want to do this in game with 2 physical bouttons (or more) one for up and the other for down.

    Sure, I want to use the GPIO to do this gestion.

    First question : it's possible ?
    Second question : What I must do to realize that ?

    Thank you for your answers.

    Raspberry Pi : 2 B+
    RetroPie Version Used : 4.1 EDIT : 4.4 (sorry)
    (thanking you and excusing me for my approximate English.)

  • Global Moderator

    @goldren said in Audio gestion with 2 physical buttons on GPIO:

    First question : it's possible ?

    I think so.

    Second question : What I must do to realize that ?

    You must learn to read the GPIO inputs and run commands for volume up/down to react to them, all with a script that runs all the time on the Pi.
    Here is a similar project, albeit with a different mechanism to send the signals to the GPIO, with a script all set-up and instructions on how to read the GPIO signals and to modify the volume.
    I'm sure you can find lots of similar projects, but you'll have to learn to adapt them to your project, which is not so difficult.
    Btw, your RetroPie version is quite old, you might consider upgrading at some point for the new features and support.

  • Thank for your answer !

    I missed to explain that, I know how GPIO work and programmed is not a problem for me, now, I want to know the variable who have to operate to change volume, really just that :) !

    thanks for the link ! And too for the upgrade of my retropie, in fact, it's just a miskate from me, i've actualy the 4.4 ! :)


    Higher volume:
    amixer set Master 3%+

    Lower volume:
    amixer set Master 3%-

    Mute toggle:
    amixer set Master toggle

  • @cyperghost You're my hero ! thanks for that ! I will do a post with my entire project soon ! thanks !

Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.

Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.