Saturday, May 18, 2024
 Popular · Latest · Hot · Upcoming
rated 0 times [  3] [ 0]  / answers: 1 / hits: 18982  / 3 Years ago, fri, june 4, 2021, 10:02:41

This one may be a little too specific, and it's probably not easily possible, but I'm going to ask it anyway. An old Dutch proverb makes me ask, "If you never shoot, you always miss."

The title is pretty much explaining the question, but in case I need to get more specific on the subject; I want to make a macro, that is activated by a key on the keyboard(such as F2). I want it to do one thing, play a sound. This is purely meant to be a novelty addon, because it has pretty much no use, and it plays the sound of Hitler shouting "NEIN NEIN NEIN". So yeah, pretty novelty.

I don't really quite care about the format needed to use(I could convert to about any format), if that's anything important. I also want to be able to assign multiple macros(each to its own key of course).

Is this possible, and if yes, how do I do it?

More From » sound


(I always used to wonder why you could answer your own question. I guess I just found out.)

I recently discovered a method to do this on Compiz desktops. If you are using Unity, you can use Sneetsher's answer. However I am using a Compiz based desktop so that doesn't apply to me, but it can be done.

First, download the audio file you want to have it play. This needs to be in OGG format, AFAIK, so if it's in another format such as mp3 then you need to convert it. A good website is here. That website also supports many other media formats, including images and videos, so if you need to convert files frequently you may want to bookmark it.

Next, open up the CompizConfig settings manager, by searching for it in the dash. Then click commands. Make sure that this plugin is enabled by clicking the checkbox to the left, if it isn't already. Then, in an empty text field, type in:

paplay <full path to file and it's filename>

So if your file is in /home/john/macros/file.ogg:

paplay /home/john/macros/file.ogg

Then take note of the label next to the text field you entered the command into(such as "Command line 0") and click "Key bindings". (There is also "Edge bindings" and "Button bindings" but it is rather impractical). Click the "disabled" button next to the binding that corresponds to the field you used, so if you entered the command in Command line 0 then click the button next to "Run command 0". In the box that appears check "enabled", and press "Grab key combination". Press any unused key that you want to trigger the sound. You can also hold shift, control, alt, or the super key.

Click OK, then click back, and exit the settings manager. Your new hotkey now works!

[#22721] Sunday, June 6, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.

Total Points: 454
Total Questions: 98
Total Answers: 122

Location: Philippines
Member since Sat, Jul 11, 2020
4 Years ago