“Doing things the way you see it, going by your own heart and soul, that is pure artistic integrity. Whatever the hair is six or sixty inches long, the eyes have make-up or not, the riffs are in 'E' or 'F' sharp, the amps are Marshall or not, all those things don't matter if you are doing it for the right reason, which to me means doing it for yourself!”
|
“What's the message in Metallica? There is no message,
but if there was a message, it really should be look within yourself,
don't listen to me,
don't listen to James, don't listen to anybody,
look within yourself for the answers.”
Lars Ulrich |
- this guy -
Although people hate Lars because he's not a great drummer and he sued Napster and can't play things right away and everything, you have to give it to the guy for being one of the most vocal drummer and speaking his mind out.
Anyway, I wanted to start the post with a cool quote and it kinda blew out. Sorry. :P
So BACK TO BUSINESS!
The drums aren't complete without pedals, right? We need the bass pedal to play the bass and a hi-hat pedal to open and close the hi-hat. If you're unfamiliar with the awesome kit that is the drums, Google has THE picture.
We followed mmidgal on his concept and used two slippers, one with a ADXL335 accelerometer and one with the photocell.
[UPDATE: The photocell that we got wasn't very effective in changing it's resistance fast, so we decided to remove this part of the kit completely]
So what we did was, we made a slit in our first slipper almost 3/4th the way in the front so as to insert the accelerometer.
|
The accelerometer was connected to the USB connector
the same way that we had done for the sticks. |
Now that we're done with all three of our elements, the easy part was hooking the circuit up. USB cables are awesome for the job, and pretty cheap as well!
Now we move on to
The Program
For the impatient, you can find the code
Here.
But I'd like to take a while and explain what we tried to do with the code and the problems that we ran into:
Firstly, a useful function to see how the Arduino is 'reporting' back changes given by the accelerometer is the analogRead(pinNum)
along with the Serial.println(var) function, both of these when used in one program displays the reading received by the Arduino program as illustrated
here. The results are then printed on the Arduino's serial monitor.
Using the above program we noticed that the value printed changes when the accelerometers are moved in their respective directions. So we figured our basic logic would be
if(valueReadBySensor > someThreshold) then return (a MIDI message)
and that's just repeated for all the other accelerometers.
One more
important thing is that we could never get our MIDI to USB converter to work with our program, after days of searching, we chanced upon a brilliant little piece of software, that reads MIDI messages directly from the USB port without the use of any DIN connectors or anything!!
It's brilliant and so simple to use!! Just select the output port as Microsoft GS Wavesynth and you're good to go! We experimented with other softwares and virtual MIDI ports such as LoopBe and MIDIyoke but we could never get a sound out of Reaper or Audacity.
Alright, so now you have your simple piece of code to play a note when the accelerometer moves an appropriate amount.
void loop()
{
int threshold = 375;
int reading = analogRead(A0);
if(reading > threshold)
noteOn(9, 35, 120);
}
[You will find the definitions for noteOn and everything in the code.]
This is great now, but what was happening was since there were a bunch of readings above the threshold that appeared as the drumstick was flicked, the S2MIDI software gave us a 'trrrrrrrrrrrrrk' sound.
So, we thought delay() was a great function, which paused the function for a certain number of milliseconds. But this still was not good enough because we could never reach a compromise between a really low delay value and the 'trrrrrrk' sound.
After days and days of experimenting, we finally decided that the code mmidgal posted on his video was the best, although we made some modifications to make it better.
|
Dave Lombardo style. Well, almost. :P |
We used arrays along with the function
millis() which really increased the response of the drum kit and allowed us to play Slayer songs. Almost.
A few things that we wanted to add were:
- A button on one of the sticks that when pressed, would play a pre-recorded drum roll.
- A crash cymbal sound when the hi-hat stick is swung a bit harder [the code was also written, but it was still a bit fickle and we could never get it right, so that one line is commented out].
- A more responsive bass pedal.
- A ride sound when the stick is swung in the X direction. This we could never get right because it was happening even when the stick was swung in the Z direction.
And that's it, so try it out and if you have any questions about the code, about the concept, criticisms on the blog or any feedback, really, please leave a post or send us an e-mail at blimptech2012@gmail.com
Sorry I couldn't post a demonstration video.. None of us are drummers, all of us are guitarists, actually, we'll make one as soon as we get our hands on a kickass drummer. :D
Thanks for reading and happy drumming!!!
- Bhargav
PS: If you have an interesting project or idea, or recommendations for our next project, do share it with us, we would love to hear it!