how to make volume up and volume down with buttons
As the title suggests, I want one button to raise the volume up and another to raise the volume down. Is this possible or is their another way of doing something along the lines of this? Cheers @retroprogrammer
ByteThis last edited by
@retroprogrammer When building a arcade cabinet, most people purchase an amp to control the volume. I purchased this one that comes with a remote to make it easier to control the volume :
DougA last edited by
I found this on Reddit. I can't confirm it works though, as I haven't tried it.
I use button combinations to control the system volume. If I hold Select+Up the volume increases, Select+Down it decreases, and Select+Left will mute. I have my physical speakers set at around 75% inside my arcade and I never actually change that. The hotkey combinations are defined in retroarch.cfg and mine looks something like this:
input_enable_hotkey_btn = 8 #Select
input_volume_up_axis = +1 #Up on Joystick
input_volume_down_axis = -1 #Down on Joystick
input_audio_mute_axis = +0 #Left on Joystick
ByteThis last edited by
@douga Interesting..I haven't heard of this before.
nasp2000 last edited by
With RetroArch you can put hotkeys for that... like the example with the stick up and down combine with the hotkey button.
Clyde last edited by
Thanks all for the reply's, @DougA I will be looking into your setup for my build
@Clyde have you already got this setup, can you confirm that it works?
Lurker last edited by
I have done this and it works but there is a little bit of a balancing act to deal with. Depending on your set up and equipment you are using, the volume is being adjusted at different points along the way and one can counter act or limit the other.
Example: I have one set up that a cheap little computer speaker is plugged into the headphone jack of the monitor with effectively no powered amplifier. Yes, technically there is a small processor in the monitor but let just pretend for my example. The hot keys work fine but the output is limited by the signal strength and my cheap little speaker, so I can adjust it up and down but only within a relatively low volume range. This is fine for that build as the only one who would need to here the games are the people directly in front of the cabinet
Next example the signal runs first to an amp and then to the speakers. In this example the amp has a volume control AND the system has a volume control. The amp has a large range of volume to move between and the signal source will be able to move a little + or - within the current volume.
So in short. If you adjust the signal strength (IE the Hoy key method) you will be able to swing the volume within the level the amp is set to. From mute to about as loud as your amp is set to and maybe into distortion ranges if you crank the signal to high.
If you leave the signal at a reasonable level you will have a much wider range of volumes (sometimes called gain) from the amp but it will be a bit trickier to implement the button up and down control you wanted. You would be tinkering with the amp and not Retropie or the Pi.
Personally, so far I have found I only really have two volume positions I use. Almost off, where I can just barely hear it and thus not bother my family or wake anyone up at night. And what I would call "normal" which is still low but clear enough to hear everything when I am not worried about bothering others. I haven't yet found a call to blast Zelda themes music or Burger time to the whole room, but hey maybe one day someone will shout "Hey, turn up that sweet Bubble Bobble jam!"
Do dew dew Da Do dew dew Da do do dew dew do...
There are a few problems with using hotkeys. First, your hotkeys are only active in RetroArch, so that is a problem for standalone emulators. Second, you have to be in a game having launched the lr-emulator in order to make the adjustment. Finally, is this a change the the emulator volume, or does the hotkey method send a command to the ALSA config and change the volume overall?
I have been using a solution for a couple years now that leverages GPIO inputs. I have a pair of buttons connected to GPIO pins and using software (you could script it or use an input utility like GPIONext, Retrogame, etc.) I have these buttons sending commands to
amixerto increase or decrease the volume:
/usr/bin/amixer -q -c 0 sset PCM 1dB+ unmet no cap
/usr/bin/amixer -q -c 0 sset PCM 1dB- unmet no cap
These work great at the command line, so they work just as well as commands linked to GPIO triggers so long as you are not doing something unusual with ALSA drivers. My speakers run off of the 3.5mm jack and I have a GPIONext running at startup to watch for me to press my volume buttons. The best part is that this works everywhere. I can be in Emulation Station, playing a game with any emulator, or even running Pixel desktop.
@caver01 How do you do this is their a tutorial any where?
DougA last edited by
zerojay last edited by
This can probably help you guys with the other end of the solution: https://www.reddit.com/r/RetroPie/comments/777ylv/how_to_map_a_controller_to_soft_reboot_your_system/
Wire your buttons to usable GPIO pins, other pole of the switches go to ground. Then, follow instructions here for installing and setting up GPIONext. What you want is to configure buttons as commands which is one of the options.
There are other ways to do the software, but the basis of this solution is to have some kind of script running, be it python or BASH that detects the button presses and sends the commands. That is what GPIONext does in addition to serving as a driver for game controller input.
Clyde last edited by
As @Lurker said, if your audio signal goes through an amplifier, you'll have to adjust that to a volume that allows a good range of volume via the hotkeys and the maximum volume shouldn't be too much for the speakers. Contrary to @Lurker, I can (and do) adjust the volume to many different levels between full and none, although it requires only the slightest nudge of the joystick to change the volume by several values.
@caver01's solution is more versatile, but for now I'm too lazy to dive into it and I'm content with RA's hotkeys. :)
Although I take my audio signal from the jack, I do run an amplifier--just a cheap thing that came with my USB powered speakers. The key to optimizing the range is to set all of your digital controls, amixer etc, to 100% so you are sending a full signal, then adjusting your amplifier volume to the maximum level without distortion (or the max you are comfortable using). Then, you can leave the amp controls alone and make adjustments digitally.
With my setup, I can tap the volume buttons or hold them down. I get plenty of granularity based on the underlying commands and I don't feel the need to increase the increment in the command. + or - 1dB seems to be a good setting that allows me to hear subtle changes with each adjustment. In other words, the change is not so small as to be inconveniently slow, and it is not so big so as to feel limiting in terms of incremental change.