Teensy 4.1 Soundboard with Wireless USB Keyboards

mjd2dh

Member
Hello all! I received a lot of support from this forum trying to get this project off the ground, so I figured I should share some of the results as well.

Warning: this project is stupid. Maybe the dumbest thing I've ever spent my time on. But it's been fun, and the final product is fun, too.

My friends and I use Discord a lot for playing games together, and we make use of the soundboard to play juvenile noises at each other. We're all going to be together for a friend's bachelor party, so I figured why not take that soundboard into the real world?

I'm using a Teensy 4.1 with 16 MB of PSRAM for sample storage during operation, a microSD card for sample loading, and a MAX98357 DAC/amp to drive a 4 ohm / 3 watt speaker. A 4-port USB hub (hacked to bits to fit in my case) is connected to the Teensy's USB host port, and 4 wireless number pad dongles are attached to the hub. The buttons on the number pads are then mapped to samples.

The whole thing is powered by a lithium battery originally intended for an iPod photo, running into a power bank chip to convert it to 5V and to allow easy power on/power off/charging.

I'll drop code for this as soon as I'm back on my laptop.

General layout:
1707184157730.png


Here's a video of it in action, and some pictures in various states.
PXL_20240206_013113368.MP.jpg

PXL_20240206_013118897.MP.jpg


PXL_20240206_013250629.MP.jpg


Some things I learned along the way:
* I tried to do this at first with a raspberry pi, but the startup time and need to be so concerned about power on/power off ruined all the fun. The teensy is instant on and instant off :)
* Multiple of these wireless keyboards can be used at once. I've had all 4 working, but one seems to have given up on me for now. No idea why.
* The USBHost_t36 library is a wonderful resource that made all this possible. For the keyboards, it was important to allot 2 USB HID objects for each keyboard - seems like they may try to enumerate as a keyboard/mouse combo.

The last neat feature I'm happy about right now is the ability to load songs from the microSD to the PSRAM for operation. I think I found that microSD was too low to allow for the rapid sample triggering I was going to need, but I wanted to be able to change samples without reprogramming. So I wrote a utility in C# that lets you assign samples for buttons, then processes the files using NAudio and outputs the correct format for the PlayMemory objects. Then, when the Teensy boots, it looks for "00.RAW" thru "18.RAW" on the SD card and loads those into the PSRAM memory, as long as your samples are less than 16 MB total. I don't need good quality audio for this application so I've got a 11khz sample rate on them to keep em small.
 
Back
Top