Lets build some drum pads!
*********************************************************************************************
This is Part 1 of 4 in the guide to Making Arduino Sampling Drum Pads
*********************************************************************************************
Breadboarding And Code Explanation
This project is based upon the Mozzi Example Sketch: Piezo_SampleTrigger. All I’ve added to it really is an if/else statement that adds the ability to choose between two samples.
Why only two samples?
Firstly the memory limitation of the Arduino only allows us to hold a few seconds of audio at most, secondly, a switch to choose between these two samples is easy to implement & gives visible feedback as to which sample is selected.
You could easily change the code to select different samples with another 10k pot (or button), but you’d have to use super short samples if you were have more than a couple. I kept it simple & just stuck with a switch.
It Sounds Too Easy?
Electronics wise it’s a nice simple build with very few components, the most time consuming part is converting the samples with a pc, then uploading them to the Arduino. It took a while to figure out how to reliably convert the samples, but this is all written down now so you shouldn’t have a problem.
Another problem I ran into was samples mis-triggering. The kind folk over at DIY electro music suggested I change how the diode was wired to the piezo and the problem was gone.
The Code
Here’s a link to the latest version of the code. Here’s the main github page which contains a couple of .h header file audio samples to get you started (which you need to drag into the Arduino IDE when the file main .ino is open). There’s further detail about this in the ‘converting samples’ section.
Breadboard
Here’s the schematic to make the Drum Pad (I used an Arduino Uno here, but a Nano will work just as well):
And here’s what it looks like in real life:
Future Expansions?
Some ideas that could be added:
A footswitch to change samples (so you could control say an open or closed high-hat), or a footswitch that triggers the sample (so it could be played with your foot like a bass drum). If you were designing an analog drum machine but wanted cymbal samples (like in a 909) you could easily incorporate something like this to be triggered by a pulse out.
Because we’re using the Mozzi library a whole heap of synthesis options are available to us. You could perhaps add attack or decay to your sample, or an LFO. Or filter? It’s up to you, you just need to add the code… check out the Mozzi example library and see if you can copy & paste it into your code.
Perhaps you’ve built the Mini-Pops 02 Drum Machine featured elsewhere on this site? By using the ‘converting samples’ section of this guide, you could replace the sounds with your own (just don’t make them too long!).
There are no doubt many more possibilities …remember to share if you make something amazing!