Difference between revisions of "Interactive Drums"
Line 52: | Line 52: | ||
− | + | Demo Video: | |
− | + | <youtube>5bVihZEgty4</youtube> | |
[https://github.com/nfbrown/interactive-drums Source Code on GitHub] | [https://github.com/nfbrown/interactive-drums Source Code on GitHub] |
Revision as of 16:23, 11 April 2015
Background
This project was done by Nick Brown, Tom Paolillo, and Hristos Giannopoulos for MU3910, taught by V.J. Manzo.
Abstract
Our goal was to design and implement a low-cost addition to a drum kit designed to add a level of interactivity to the set. We used a Cypress PSoC for the embedded processing, which handled hit detection and lighting up different LEDS on each drum. This was combined with a Python application which could parse MIDI files, and send the data to the PSoC, which would then light up appropriate drums to teach the user how to play a song.
Description
There are three main components to this project:
- Embedded code written in C for a Cypress Programmable System-on-a-Chip (PSoC)
- Backend code written in Python for parsing MIDI files and sending data to the PSoC over serial
- Graphical user interface (GUI) written in Python using Tkinter
Embedded
The embedded code handled three things: lighting up LEDs on drums that need to be hit, detecting drum hits, and communicating over serial to the PC. The code works as follows:
1. Receives data from PC including which drums to light up and when
2. Turns on red LED on drum before it needs to be hit
3. Turn off red LED and turn on green LED when the drum needs to be hit
4. Checks for drum hit using microphones attached to each drum
PC Backend
The Python backend includes two modules, one that deals with the communication between the PC and the PSoC using the pySerial library, and one that uses the Mido library to parse drum based MIDI files to convert them to a predefined packet structure that the PSoC is programmed to understand. The packet structure can theoretically support up to 16 drums, but the PSoC can only support 8. We used 4 drums for this project to keep things relatively simple, since only created a prototype.
PC GUI
The GUI, written in Python using Tkinter, allows the user to select between the three different modes of play as well as allowing them to choose a song. The three modes of play are Training Mode, Score Mode, and Show Mode. Training Mode will set the PSoC to wait for the player to hit the drum before continuing to the next note. Score Mode requires the user to play the drums, in time, as the PSoC lights them up. Both Training Mode and Score Mode will display a score on screen for the player. Show Mode does not require a song, and instead lights up the drums in reaction to them being hit. This mode could possibly be extended to be used to create MIDI drum files.
Difficulties
The most difficult parts of the project were related to detecting drum hits and parsing MIDI files. For hit detection, we decided to use cheap microphones places right beneath or inside the drums. When the PSoC is powered on, it lights up each drum in order, and the user must hit them to calibrate the threshold that the PSoC will use to detect drum hits. For MIDI parsing, we used an existing library to parse out each of the MIDI events to attempt to turn them into serial packets to send to the PSoC. Because the PSoC is set up to process packets on a timer, we have to send packets to the PSoC regardless of whether or not drums need to be hit. This made converting the time in MIDI note on events into a series of packets very difficult. We ended up with MIDI parsing that appears to work on relatively simple MIDI files that contain only drum tracks.
Conclusion
This system could be installed on an existing drum kit for less than approximately $30. While it is a relatively rudimentary system, it is accessible and extensible. Currently, the system only supports Linux PCs, but we plan to add support for Mac and possibly Windows in the future.
Demo Video: