# AutoPRK - Automatic Drum Player

Filip Biedrzycki, Jakub Knast, Mariusz Nowak, Jakub Paszkowski

► To cite this version:

Filip Biedrzycki, Jakub Knast, Mariusz Nowak, Jakub Paszkowski. AutoPRK - Automatic Drum Player. 14th Computer Information Systems and Industrial Management (CISIM), Sep 2015, Warsaw, Poland. pp.592-600, 10.1007/978-3-319-24369-6_50 . hal-01444501

HAL Id: hal-01444501

https://inria.hal.science/hal-01444501

Submitted on 24 Jan 2017

**HAL** is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_1.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
autoPRK - Automatic Drum Player

Filip Biedrzycki, Jakub Knast, Mariusz Nowak¹, Jakub Paszkowski²

Institute of Computing Science, Poznan University of Technology, Poland

¹Mariusz.Nowak@put.poznan.pl,

²Jakub.Paszkowski@student.put.poznan.pl

**Abstract.** The paper presents the new solution of the robot playing percussion. There are two ideas of such robots: imitating a human body and realizing its function in an artificial way - without imitating a human. The presented solution belongs to the second group. It consists of 8 arms and two peripherals for control two pedals. Authors developed of entire construction of the robot and they write the software in Java for control the device. The sticks and pedals are excited with electromagnets controlled by the microcontroller ATmega328 on an Arduino board which interprete MIDI files. Authors declare full success of the project.

**Keywords:** Musical Robotics, Drum, Percussion, MIDI, Solenoid.

# 1 Introduction

Robotic drummers are devices which can play the percussion using specially designed peripherals moving with the usage of electromagnets or pneumatics. There were many projects that tried to achieve that phenomenon. For instance, people used simple controlled microprocessor percussion sticks installed on drums or complicated humanoid robots. The problem is complicated, because percussions often have many elements such as central bass drum, snare, tom-toms, big floor tom, hi-hat and cymbals [1].

The main challenge of this project was to create a robotic drummer which playing skills would be equivalent to human ones, or even better. The quality has to be good enough to let other instruments accompany (e. g. a guitar) like it was a real musician. The machine has to be customizable to be useful– it should match any percussion without any interference in the structure of the instrument and it must handle any possible element of the instrument. Hence, changing location of the drums only to set this up is unacceptable. The robot was designed in such a way that its shape can be altered to be fitted to the instrument. Everything ought to be easy to use for any person, and the configuration has to be as quick as possible - the whole process has to take less than an hour. It means that installing and setting percussion sticks needs to be fairly easy and operating the software and loading songs has to be quick and intuitive.

A lot of robotic drummers are not one-part machines. There are many separated sticks connected to elements setting them in motion. However, each of them has to be
installed on their drums so there is a need for interference in the structure of the
percussion. A good example can be "Thelxiapeia" created by N.A. Baginsky. More
ambitious constructions try to replicate human by moving human-shaped arms with
elbows and hands ended with sticks. The robot created by MIT Researchers (named
"Cog") has even got a head on its torso. There are robots controlled by MIDI files too,
like "TibetBot" designed by Eric Singer and LEMUR. All these solutions are
described by Ajay Kapur in [2].

AutoPRK name is a shortened form of phrase automatic percussion (pol. automatyczna PeRKusja). AutoPRK, the robotic drummer has eight stable arms connected to one central stem with specially designed and created ponds that allow to set each of them up and block them when the setting is complete. The only moving element is the percussion stick on the end of every arm. Moreover, there are two peripherals for controlling pedals of the percussion - hi-hat and central bass drum. Everything moves with the usage of electromagnets connected to the microcontroller using relays. A specially created application allows to load MIDI file tracks.

The paper is structured as follows. In the second Section an overview of various robotic drummer constructions is given. Next Section introduces the autoPRK Automatic Drum Player - details of its construction, electronics and software are presented. Fourth section is dedicated to the tests and experiments that were carried out throughout the whole process of autoPRK construction and their results. Fifth Section concludes the paper.

## 2 Related Work

There are few ways of generating movement for robotic drummers. J. Long et al. shows the most commonly used solutions in [3]. One of these groups contains solenoid-based mechanism (rotary or linear). Durability of the parts, low latency and cost make them good choice for parts to apply - opposed to RC Servos. The only disadvantage is that they cannot play as loud as it is needed (Servos are better here). Pneumatic mechanisms are often used in robotics too- they represent the highest capabilities of loudness, but are more expensive than solenoids. According to this research, 50W linear solenoids were used in autoPRK.

Ajay Kapur from University of Victoria presents materials related to some projects about this topic in [2]. Definitely, the most advanced of them is the robot called "Cog" - a humanoid moved thanks to the hydraulics, and it can play the percussion like a real man, using only two arms. The team of Mitsuo Kawato (the creator of Cog) found an interesting solution to constructing hands imitating human ones. A drum stick is installed only by a pivot at quarter of its length and can freely move while playing. The movement of the stick is produced in the whole arm - not at its end, in a hand. Chico MacMurtie in [2] suggests different solutions to drum stick moving problems. The robot he created has got no sticks, but silicon hands, which are used to hit the membrane.

A different approach to the problem, presented by Baginsky in [2], assumes building a robot without any construction imitating a human body. The construction is
rather simple. A percussion stick is installed on the drum and there is an element making it move.

Some of the robots can play more than one instrument. Good example of this is "Shimon" which can be set up to play drums or marimba. This is only one example. Marcelo Cicconet et al. presents more in [4].

Topic of robotic instruments is very wide. Some examples are presented by Kishan Kumar et al. who show a robotic Pan Flute in [5] and Wonse Jo et al. who propose a Violin Playing Robot in [6].

# 3 Detailed solutions in autoPRK

## 3.1 Construction

Structurally the robot consists of a high (approx. 160cm) pipe and eight independent, fully-configurable arms attached to special connectors (Fig. 1). This means that if needed, there is possibility to put two arms on one connector or remove the ones that are not used while playing a given song. Furthermore, for each of them the length of the arm can be set, as well as the individual angle at which it will be tilted to the drum kits. All eight arms of autoPRK are constructed identically. Each arm can be positioned over various percussion elements, such as a drum or a plate. A single stick hits the drum element after receiving a signal from the Arduino.

<figure><img src="image_2.png" /><figcaption>Fig. 1 Construction of the autoPRK robot</figcaption></figure>

In addition, the composition of the robot consists of two elements simulating the drummer's feet (Fig. 2). After proper configuration and placement on the floor, they can handle the bass drum and a hi-hat foot.

Every end effector is moved by the same electromagnet so each of them has the same strength of hitting. The difference between the parts for drums and parts for
percussion feet is in the way the electromagnets are located. In arms, there are pulling solenoids installed below the sticks, which are activated to make a hit. On the other hand, to play on bass drum or hi-hat, pushing solenoids are used. The percussion pedal is pressed directly by them, to make a sound.

<figure><img src="image_3.png" /><figcaption>Fig. 2 Feet of the autoPRK robot</figcaption></figure>

## 3.2 Electronics

Electronics contains two different circuits. First of them - controlling circuit which is operating on 5V is powered by USB port. It consists of a microcontroller ATmega328 on an Arduino Uno Compatible board and is connected to ten relays. The second circuit, controlled by relays, uses 12V current generated by three PC supplies. Each relay is connected directly with one of ten 50W electromagnets located at the end of every arm or on foot. All the elements of electronics are located on a transparent board, which is presented in figure 3.

<figure><img src="image_4.png" /><figcaption>Fig. 3 Elements of electronics</figcaption></figure>
## 3.3 Software

Software is divided into two different parts, one is a Java application KuKuFi, that provides user interface, process data, and send them via USB port to the second part which is a microcontroller Arduino. The task of the Arduino is to control relays using the data obtained from KuKuFi data. Figure 4 shows a data flow diagram.

<figure><img src="image_5.png" /><figcaption>Fig. 4 Data flow diagram</figcaption></figure>

### KuKuFi overview

KuKuFi is a program written by the authors of autoPRK for the purpose of an easy control and KuKuFi name comes from the first letters of the names of the creators (Kuba, Kuba, Filip). The task of the program is to display and manage a graphic user interface and communicate via USB serial port with a microcontroller Arduino. KuKuFi works in such a way that the user will control autoPRK in an uncomplicated way.

KuKuFi is written in Java. It uses several free libraries, for example Swing, to build the GUI, RXTXcomm to communicate via the USB port, JSON to manage files in JSON format and a very important package - javax.snd.midi - to decode MIDI files.

When the program is activated, a form with separate fragments illustrating the four steps that one should take to start autoPRK is presented to the user.
<figure><img src="image_6.png" /><figcaption>Fig. 5 Selecting the MIDI file</figcaption></figure>

The first step (Fig. 5) contains a selection of MIDI files that the program has to play - clicking on the button "Open" displays a file selection dialog from a hard drive.

After selecting a file, the program searches all stored MIDI tracks in the file.

The second step (Fig. 6), which the user must take, is selecting from a dropdown list the drum kit track. The program suggests the correct option. After confirming the selection, it starts to operate a specially designed algorithm. It is the task of selecting all elements that are in the track of the drum kit. Then the program selects from the track the moments in which drums are playing. These moments are read as the MIDI ticks and they are not clear moments of time. To convert them to a unit of milliseconds, respectively algorithm multiplies them by BPM (Beats Per Minute) and PPQ (Pulse Per Quarter note) [7].

<figure><img src="image_7.png" /><figcaption>Fig. 6 Selecting the drum kit track</figcaption></figure>

Obtained in this way time stamps are stored sequentially in arrays - but each percussion element has its own array. Now, the moments when the stick will hit are stored in tables and they can be later sent to Arduino.

In the third step (Fig. 7), the user must pair the drum kit elements selected from the MIDI file with the numbers of autoPRK's arms. From the user's perspective, this process takes the longest period of time, so in order to improve it, there is a possibility of saving the prepared configuration and load it later.
<figure><img src="image_8.png" /><figcaption>Fig. 7 Pairing drum kit elements with autoPRK's arms</figcaption></figure>

When all percussion tracks are connected with numbers, the user must press the stop button (Fig. 8). Then signal is sent to the Arduino to ask about the data. Arduino will begin recording in the memory first moments of drum beats. When the data is received, the user goes to the final fourth step and can press the "play" button to start autoPRK.

There is also the “pause” button to stop autoPRK in the middle of the song.

<figure><img src="image_9.png" /><figcaption>Fig. 8 Buttons for controlling the robot</figcaption></figure>

## Arduino overview

Microcontroller Arduino is used in order to control relays. Due to the limited working memory to 2kB microcontroller ATmega328, only 400 next hits can be stored (40 per track) in 10 cyclic buffers (one for each track). This is only enough for a few seconds of the song. It begins working after receiving a stop signal. In the beginning, the first moments of drum beats are stored in the memory. Then Arduino waits for “start” signal and after receiving it, microcontroller starts to operate relays checking if the time to the next hit on each track elapsed. If it did, it gives logical
HIGH signal to the corresponding track number relay for 40 milliseconds. This interval of time is long enough to make percussion stick hit powerfully enough to produce a loud sound. Because only the beginning of the song is stored in the memory, Arduino must collect data while playing the song. It is resolved by sending small packets of data (64kB) in real time. In each packet there are eight consecutive beats sent. The size of the packet is caused by small size of the serial port buffer.

## 4 Experiments and their results

The tests were carried while building the robot. The decision how to install the parts was based on earlier trials. A good example of it was searching for a place to place the pivot for drum sticks – about ten different places were tried before making the final decision.

To confirm if all applied solutions are correct and if the robot is able to play the drums in a way allowing other instruments to accompany, there was a presentation of its capabilities after finishing the construction. Primarily, there was a need to analyse durability of used relays, because they had caused problems in the past.

The presentation was very successful - AutoPRK was playing for about 30 minutes without a break, including dynamic and requiring tracks, and all the elements worked correctly, without any faults. The strength of hitting drums was balanced, the speed of playing – appropriate, and the construction - stable.

Based on the number of visitors participating in the presentation it can be said that the show was a success. It means that the listening experience was on high level and listening to the robot playing was as pleasurable as listening to a human musician.

The project and the presentation is attractive for the potential recipients not only as a novelty, but can be seen as a product that can be used in life due to the way it is made – good-looking, easy to use, with almost unlimited capabilities of music to play. All those factors make this robot practical and possible to exploit in a large-scale music making projects.

## 5 Conclusions

The final construction meets all the assumptions. AutoPRK plays as well as a human - in some cases results are even better. It can easily play sixteenth note of 180bpm song using only one bass malleus or snare tremolo on one drum stick. All the elements work correctly, and in effect the sounds of drums are clear, loud and the pace is regular all the time. The tests show that the robot can be customised to every percussion, without changing locations of the drums, and setting everything up takes about 40 minutes. All the arms can be flexibly changed and each of them can handle every percussion element. Easy application allows the user to load the MIDI file and stream data to the robot to start playing.

AutoPRK project connects popular solutions for percussion playing robots, such as assigning each stick to only one drum, using linear solenoids to move them with practical, aesthetic construction. What is more, the cost of building the robot is
relatively low. This can provide wide capabilities of songs to play on every
percussion and a user-friendly service. There were no constructions similar to this.

Future plans connected with this project involve rebuilding it into a different
machine, with two moving arms, for playing drums, legs for the percussion pedals
and a head for making construction more humanlike. It will be equipped with a
camera or other kind of sensors and appropriate algorithms allowing the robot to
customize itself to the percussion without any help of the user. What is more, the
robot will be connected to a microphone in order to listen to other instruments and -
when it is asked - improvise playing with them in the same pace, metre and fixed
style.

References.

1. http://perkusja.rockmetal.art.pl/800/co_to/co_to_jest.html

2. Kapur, A.: A History of Robotic Musical Instruments. ICMC, (2005)

3. Long, J., Murphy, J.W., Kapur, A., Carnegie, D.A.: A Comparative Evaluation of Percussion Mechanisms for Musical Robotics Applications. Proceedings of the 6th International Conference on Automation, Robotics and Applications, 173-178 (2015)

4. Cicconet, M., Bretan, M., Weinberg, G.: Human-Robot Percussion Ensemble. IEEE Robotics & Automation Magazine, 105-110 (2013)

5. Kumar, K., Chand, P., Carnegie, D.A.: Pan Piper 1.0 An overview of a Robotic Pan Flute for Pacific Music, IEEE Asia-Pacific World Congress on Computer Science and Engineering, (2014)

6. Wonse, J., Hyeonjun, P., Bumjoo, L., Donghan, K.: A Study on Improving Sound Quality of Violin Playing Robot, Proceedings of the 6th International Conference on Automation, Robotics and Applications, 185-191 (2015)

7. http://www.midi.org/techspecs/