If you like this project and want a way to integrate it with your Twitch chat, check out my soundboard-twitch-bot project
After trying several other soundboard tools available for download, I was never quite satisfied.
- I wanted a tool that would make it easy to play specific sounds from a library of hundreds of sounds.
- I wanted the ability to play a random sound from a category, such as a random compliment or hello.
- I wanted to do this without having to bind a series of keybinds or set up a second keyboard.
- I wanted to be able to quickly add and reorganize my sounds without having to update the script itself.
I found a tool by Asger Juul Brunshøj that uses a GUI to allow you to run AutoHotKey macros via text commands. I've adjusted the script quite a bit to fit my needs, and what we have now is Squishy's Soundboard!
In order to run this script, you must have AutoHotKey installed on your system. Additionally, this script utilized VLC Media Player for audio playback.
This repo has a /sounds
folder with a couple of sounds to get you started. The script scans filenames in order to generate a list of categories and individual sounds, which are then populated into the interface.
In order for the script to work, you will need to make a couple of changes specific to your setup.
-
Run VLC Media Player.
-
Go to Tools -> Preferences.
-
Click on the Audio tab. Click this tab first or else you won't get a list of sound devices!
-
Under Show settings section at the bottom left of the window, choose All.
-
Under the Audio category on the left, expand Output Modules and select WaveOut.
-
Under the Select Audio Device dropdown box, look for CABLE Output, or whichever sound device you set as Hardware Input 2 in Voicemeeter. You need to copy EXACTLY what it shows in the dropdown box. Write or type down exactly what is in here.
-
In the folder where you saved the soundboard repository, open user-settings.ahk in a text editor.
-
Search the file for the below line. Replace the portion in double quotes after the equal sign with the device name you wrote down in Step 6.
global vlc_audio_out := ""
-
You may also have to change this line to point to your VLC executable if the path differs.
global vlc_path := "C:\Program Files\VideoLAN\VLC\vlc.exe"
-
Save the script.
The base requirements to use the script require installation of both AutoHotKey and VLC Media Player. If you want others to hear your sounds when you play them, you will have to configure some additional software. I wrote an article detailing how to do this that you should check out!
To start using the script, double-click SquishySoundboard.ahk
in the main folder. Once the script is running, you can press CapsLock + Spacebar
to minimize/maximize the gui, making it quick to swap to/from a game or other window.
Use filter textbox at the top of the window to filter the items in the list. You can either double-click an item in the list, or press Enter
in the textbox to play the sound. Note: Pressing Enter
in the textbox only works if there is one item remaining in the category or individual items list. Pressing Escape
with the window open will stop playing the sound.
Note: By default, Caps Lock will not work while the script is working. You can press Alt + CapsLock
to toggle it on and off.
When I made this script, I wanted it to be very easy to add and organize your sounds without needing to do anything with the script. In the project root, there is a sounds folder. All mp3 files you add to this folder will automatically be brought into the script as soon as you reload the script.
Your file name should follow this structure:
search terms for file [category1, category2].mp3.
The script will check each file name and take the comma-separated category names from with the []
square brackets. The individual file names list is everything in the file name not enclosed in the square brackets.
I find it works best to use as many of the words from the sound file in the file name, making it easy to filter down and get to the exact file you want. You can add as many categories as you want, allowing this file to be included if you randomly play a certain category.
If you are looking to rip your own sounds from videos or other sound sources, you will want to check out this article I wrote on setting up a virtual audio cable to play the sounds through your mic input, as well as tools to equalize the volume of the sounds and rip your own.
If you share sounds with other users of the soundboard, you may run into issues where the files are blocked. You can run the below in PowerShell to unblock the files.
dir -Path [directory path] -Recurse | Unblock-File
The below steps are optional. You only need to do anything detailed below if you want to use a second keyboard to trigger random sounds.
Getting AHK to intercept keystrokes from a second keyboard, but not pass those keystrokes to Windows, requires the installation of a couple of tools, as well as some additional updates to the user-settings.ahk
script.
In order to get a second keyboard working, you will need to install the AHK Interception Driver 1.0.1. Installation requires specific steps that I will detail below. Do not just double-click files in the download or it won't work!
-
Download the AHK Interception Driver 1.0.1 and then open the file. Extract the
Interception
folder to your Desktop or other convenient location. -
Run command prompt as administrator.
-
Browse to the
Interception
folder you extracted, then into thecommand line installer
folder. -
Type
install-interception.exe /install
. -
Reboot after the install.
The AHI tool makes the Interception driver available in our AHK script to use. This allows us to actually capture the keystrokes and act upon them!
-
Browse to your Soundboard folder, then into the
scripts\AHI\Lib
folder. -
Right-click on
Unblocker.ps1
, then clickRun With Powershell
. This is because downloaded DLLs are often blocked and will not work. This can be done manually by right clicking the DLLs, selecting Properties, and checking a "Block" box if it exists.
Every keyboard has a unique VID and PID, and this will allow our script to target and intercept the correct keyboard.
-
Plug in your second keyboard.
-
Browse to your Soundboard folder, then run
scripts\AHI\Monitor.ahk
. -
Check the boxes next to all Keyboards, then press a key on your second keyboard. The output portion of the window will show the ID of the device. Look to the corresponding keyboard with that ID, and then jot down the VID and PID. In the example below, our VID is
0x04CA
and the PID is0x0022
.
- Open
user-settings.ahk
, then update the below lines with your own values.
global keyboard_vid = 0x04CA
global keyboard_pid = 0x0022
Once everything is set up, you will need to update the keymap object in user-settings.ahk
with your own preferences. I have added comments to help you understand which property corresponds to which keystroke. You can ignore the spacer: ""
property, as that is just there to make reading easier.
Example
global keymap := { spacer: ""
; Key: 1
, 2: ["hello", "bye"]
; Key 2
, 3: ["insult"]}
With all of that done, pressing a key on your second keyboard sdhoulpd play a random sound from one of the categories you listed in the keymap!