April 7, 2013
The Bleep Drum has about 24 kilobytes of space for samples in the program memory. That’s just over a second at 22k samples/sec.
That might not sounds like much but it’s enough for the four pads on the Bleep Drum.
Here’s a guide for adding your own samples.
At the beginning of the bleep drum code there are four tables that hold the samples, “kick”, “tick”, “snare”, and “bass”.
PROGMEM prog_char kick_table =
You’ll be wanting to replace the bytes in the table with your sample.
Audacity is a great program to do the wav manipulation in.
Get your mono sample cropped as small as you can, making sure to start at zero and having a very quick fade out at the end to reduce pops.
Reduce the sample rate to 22kHz and the bit depth to 8. Try playing with the dither options to see what sounds best.
Once it’s ready go to Analyze > Sample data export
Now you need to turn that unformatted pile of numbers into something useful.
Open the text file in a spreadsheet program with tab as the separator.
Use this file as an example on how to turn the floats into bytes.
Make a note of how many bytes there are.
Now you’ll need to make that last column look like this:
You can do this by saving it as a separate .csv or copying it into a text editor and replacing “/n” with “,”.
Now you can copy those commas separated bytes into the tables and change the length value.
If the sketch won’t compile you’re probably over the program space. Try removing strings of small numbers (0,3,0,2,0,1,0,1,0,1,1,0,1,0) from the end of your samples if you need to shave off a few bytes. You might also want to start by removing some or all of the default samples so you have the whole second to work with.
You could also change the sample rate by adjusting “OCR2A” in “DDS”.