How do I use this software to make my extra keyboard a soundboard?

Announcements, questions
Post Reply
Gold_Ghoti
Posts: 1
Joined: 10 Mar 2020, 06:07

How do I use this software to make my extra keyboard a soundboard?

Post by Gold_Ghoti » 10 Mar 2020, 06:19

Preface:
For starters, what I'm trying to do is apply something I've seen in Tom Scott's video "The art of the bodge" where he used 14 keyboards to have each key be instantly an emoji but instead I want to use it to trigger a soundboard I'm setting up for gaming with my friends.

The soundboard application I'm using is called "Voicemod" and functions primarily as a voice changer though it has a soundboard portion where key presses/combinations will trigger a sound to be played.

I also have zero programming knowledge!

Main:
So, how do I use luamacros to turn single key presses on my second (or third) keyboard into macros for Voicemod with minimal coding? Is there a sort of master list of "Change the key number input and command output as needed" or some basic code that's just to be repeated over and over again? I'll be honest my programming knowledge ends at HTML from 10 years ago and this is a silly idea I'm not exactly willing to learn a whole programming language to pull of so I'm entirely hoping there's some easy, sloppy, lazy way of doing it.

End:
I hope I'm not angering anyone with this. Whenever I have ideas like this and try to see if someone who knows this off the top of their head will be willing to give a hand or some guidance I always get a bunch of people complaining about how I could just google this or how I should just learn it like everyone else. While those are true I have a specific goal and really don't want to spent weeks or months learning and researching for a small silly idea. If it turns out I enjoyed the flexibility or found it easy to modify the script or whatever I may then start looking into learning Lua on my own.

If I frustrated or upset you with this post I'm sorry, I am being lazy I'll admit it. I just hope someone will be willing to give me a gentle nudge towards getting this specific idea to work and those who dislike my laziness will move on and just ignore me. Thanks for your time and sorry for rambling.

owcs
Posts: 3
Joined: 24 May 2020, 05:22
Contact:

Re: How do I use this software to make my extra keyboard a soundboard?

Post by owcs » 24 May 2020, 05:27

Hey, I'm trying to do almost the exact same thing!
I just got my keypad in the mail today and I spent a while trying to figure out how to get it to work. Since the old HIDMacros program didn't work for me, I decided to try to use LuaMacros. Like you, I don't want to learn Lua just to do something simple like remapping keys. Currently, I have it partially working, but it is sending the keystroke more than once. I was just about to post something here asking if anyone could help me with the simple task, and I came across your post. I'd be happy to update you when I get this all figured out. When I'm done, I'll give detailed instructions on how to do this, since there really aren't any guides anywhere. Please update me too if you figure anything out. Good luck!

owcs
Posts: 3
Joined: 24 May 2020, 05:22
Contact:

Re: How do I use this software to make my extra keyboard a soundboard?

Post by owcs » 28 May 2020, 01:23

Hey! I figured it out, but I'm too lazy to type out all of the instructions. If you or anyone else who sees this wants to know how to make a soundboard with luamacros, dm me on Discord (hujiba#3070), Reddit (u/hujibanation) or Twitter (@owcschafer) since I probably won't know if anyone replies to this post.

owcs
Posts: 3
Joined: 24 May 2020, 05:22
Contact:

Re: How do I use this software to make my extra keyboard a soundboard?

Post by owcs » 17 Mar 2021, 19:52

I typed it out anyway since a lot of people asked



I might not get everything right so please tell me if you have any questions or if something doesn't work. Also, I don't know how much you know about things so I might be over explaining some parts. Hopefully I get everything right.

First, you should think about if you need luamacros. If you are planning on using a USB numpad as a soundboard, and still using your keyboards numpad regularly, then you will need Luamacros. If, (1) you do not use your main keyboard's numpad and it would be fine to have it trigger sounds as well or (2) your keyboard does not have a built in numpad, so the external one is the only one, you're probably better off using AutoHotKey. I haven't used it much and I can't help you with it, but it's much more popular and you can definitely figure out what you need to do on your own. Otherwise, you need luamacros.

Obviously what you need to do first is install luamacros. Run the exe and in the text box at the top paste and run this: lmc_print_devices()
You should see something like this (I copied it from a forum post):<unassigned> : Saitek X52 Flight Control System [0] : game
<unassigned> : Saitek Pro Flight Rudder Pedals [0] : game
<unassigned> : BU0836A Interface [0] : game
<unassigned> : \\?\HID#VID_1C4F&PID_0002&MI_00#9&826BD90&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD} [327833] : keyboard
<unassigned> : \\?\HID#VID_04FC&PID_05D8&MI_00#7&1BDC3055&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD} [65605] : keyboard
<unassigned> : \\?\HID#VID_046D&PID_C52E&MI_00#9&12234230&0&0000#{884B96C3-56EF-11D1-BC8C-00A0C91405DD} [720963] : keyboard
Total number of devices: 6 except it probably won't have flight simulator stuff like that post did. Yours will probably only have keyboards.

Now unplug your keypad and run it again. One of the devices should be gone. Replug it and run again, just to make sure. Once you have identified which keyboard it is, (I think) you should see something within that line like ID_0001. Make sure you know that ID.

Now, download the file I have attached below. https://cdn.discordapp.com/attachments/ ... /sound.txt
Right now it is a txt but it needs to be a Lua file. Rename it to sound.lua (or whatever you want as long as it has the Lua extension). Make sure you're changing the extension and not naming sound.lua.txt. Now, open that file in luamacros. The code should show up. In the second line you should see lmc_device_set_name ('KP', 'ID_0001');. Replace ID_0001 with your keypad's ID. You can put the previous code to check the devices after that line if you want, and check to see if your device changed from unassigned to KP. If not, it's probably my problem, as I don't know exactly if I gave the right instructions. If it does work, move on to the next step.
The line if (button == 0) then lmc_send_keys('{F13}') is the first keymap. For your first keymap, while the code is running, press a key on the keypad. The bottom section of the window should say Not yet assigned: and then a number. That number is the ID for that key. Replace the 0 with that ID. The ('{F13}') section is the output key. Right now, it's the F13 key, which technically exists even though no modern keyboards have it. In fact, there are F keys all the way up to F24. They are very useful for things like these and I used all of them for my soundboard. If the key ID for the key you want is 24, and you want to output the F14 key, your line should look like this: if (button == 24) then lmc_send_keys('{F14}'). If you do not want it to activate a F key, such as a letter or normal character, do the same thing, but without the curly brackets. The curly brackets are there so that it presses F14 instead of typing out "F14". So if you want it to output a you would use ('a'). Hopefully that cleared up the syntax.

The next lines are basically the same with one small change. The first line is the only one that starts with "if". The rest start with "elseif". Every one after the first one needs to start with "elseif". Otherwise, the syntax is exactly the same. If you wanted the same function as last time but on the second line, you would want elseif (button == 24) then lmc_send_keys('{F14}').
Any lines after that are exactly the same. Copy and paste the entire second line onto the third line and replace the values. Do this for every key after, one line after the other, with each on its own line. That should be all you need for the code. Run it and hopefully it works.
For the soundboard I recommend exp soundboard as opposed to something like voicemod, because I know it works and does what it needs to do. It is free and supports all keys, although it is a bit buggy.

I think this is all the information you need. I probably messed up somewhere so tell me where I went wrong or if you have any issues. Good luck!

Post Reply