Clap Tracking for a Robot Drummer
Neil MacMillan
For G. Tzanetakis, CSC 475University of Victorianrqm@uvic.ca
Abstract
This document describes a project involving amodification to the existing robot drummer, allowing it torespond in real time to audio stimulus (hand clapping)without needing external equipment. The stimulusdetection, timing considerations, clap tracking andprediction, and results are all discussed.
1.
Introduction
To satisfy the requirements for a past course at UVic, I andtwo other engineering students, Matthew Loisel and DanielPartridge, designed and built a robot drummer that couldstrike a drum in response to Musical Instrument DigitalInterface (MIDI) input. [1] That project was mostlysuccessful, but once it was completed there were still manyways that the robot could be made more useful orinteresting. One problem with the robot is that it is limitedto MIDI input. It can accept commands from any MIDIsource, but it requires such a source
—
for example asynthesizer or computer
—
to be present. In other words,the robot is not a standalone machine.The robot can be improved by adding capability todrum in direct response to live audio input such as handclapping, instead of requiring some complex external pieceof equipment to translate analog signals to MIDIcommands. It would be even more interesting if the robotcould, when a regular rhythm is being clapped, drum alongwith the rhythm
—
not in response to the claps, but byanticipating each clap and striking the drum at the precisemoment of the clap instead of shortly after it.This document will describe the three core tasks that Iundertook for this project:-
Designed and built a sensor for detecting a handclap and outputting a digital signal. This turnedout to be the main task.-
Measured the delays between a stimulus to therobot drummer and the drum strike.-
Modified
the robot’s firmware to accept the clapsensor’s digital signal, and to predict when the
next clap in a simple beat will occur.
2.
Clap Detection
The robot must be able to gather input before it canrespond to claps. I looked for an off-the-shelf clap sensor,but could not find one that was cheap and producedappropriate output. I decided to build a clap sensor fromscratch. This involved designing a circuit for the sensorand laying it out as a circuit board, purchasing parts,etching and assembling the circuit board, installing thecomponents, and writing the firmware.Without the clap sensor, there would be two choices forclap detection. If the robot drummer did clap detection,then the signal processing component would add asignificant processing a
nd memory load to the drummer’s
firmware. The sensor offloads this work onto acoprocessor that transforms the analog input into a digitaloutput that is very easy for the drummer to read. Anotherway to do clap detection would be with a computer.Clearly this would undermine one of the points of thisproject, which is to make the robot drummer moreindependent. In addition to that, my experiments showthat sending MIDI commands over USB incurs atransmission delay between 10 and 30 ms. The mainproblem is the delay variance, which is impossible topredict or to correct.
2.1
Clap Sensor Circuit Board
10
μ
FATtiny84MicTRSJack 2.2 k
Ω
1.5 k
Ω
ISPLED
10 k
Ω
5 V100
Ω
Output
+
Figure 1. Clap sensor circuit diagram.
Permission to make digital or hard copies of all or part of this work forpersonal or classroom use is granted without fee provided that copiesare not made or distributed for profit or commercial advantage and thatcopies bear this notice and the full citation on the first page.© 2009 University of Victoria