The sound samples are free samples from musicradar.com. They are assembled in one 8-bit, 11.025 KHz mono wav file with silence as separator. I slowed the samples down and toned them lower before converting them to 8 bit, because the drum kit can run at 16KHz sampling rate. This runs the samples (which are at 11.025KHz) faster/higher, which improves the sound quality a bit.
A Python script converts the file into 5-bit data, where 5 bytes each contain the data for 8 samples. It also finds the starts and ends for each segment. It converts the audio data into 7-bit and then uses a optimized nonlinear mapping to convert them into 5-bit. The output from that script is an Arduino type data array which is copied into the source code of the drum kit, together with the arrays for the start and stop positions. Note that I cannot re-publish the drum samples that I used, and hence, the Arduino code that is online uses dummy-drum sounds for each instrument.
The Arduino code (see "files") used a lookup table to convert the 5-bit data back into 7 bits. It then adds the samples that are playing at the moment and outputs them to the 8-bit DAC.
The code uses the digital (and some analog) ports as GPIO to detect the drumpad hits, and the digital ports 0-7 (PORTD) are connected to a 8-bit R2R DAC.
The electronics are trivial:
- At rest the switches under the drum pads are closed, and the VCC pulls the lines up to 5V against 10K pulldown resistors. When a drumpad is hit, the line goes to 0. Debouncing is done in software.
- The R2R DAC is made from 10K and 4.99K resistors, and its output goes into a 2 stage RC element and then into the headphone amplifier. The RC element has a 10K resistor, behind that 100nF to ground, then again a 10K resistor and another 100nF to ground.
- The amplifier is based on a TDA2822.