Showing posts with label electronic drum kit. Show all posts
Showing posts with label electronic drum kit. Show all posts

Saturday, 19 May 2012

Arduino Drum kit, part 4 - Arduino considerations

Hello everyone, quick update on this:

I've recently purchased a new Arduino. In this case, Arduino Mini Pro, which is manufactured by SparkFun. I got mine from Proto-Pic. So why did I go for this when I've got a perfectly good Arduino Uno?

Well, a couple of things - the primary reason is that it has more analogue inputs, 8 to be precise. They'd recently been updated to be based on the 328 chip as opposed to the 168, but this latest revision includes the two additional analogue inputs. As each piezo transducer will need an analogue input, effectively each 'drum' needs it's own analogue input. With 6 analogue inputs, this limits the kit to 6 individual instruments. A possible kit would be:
  1. Bass Drum
  2. Snare
  3. Hi-Hat
  4. Crash Cymbal
  5. Tom High
  6. Tom Low
This is a pretty cut down kit. Not exactly terrible, but it would be nice to have more. With two more inputs, a ride cymbal and a floor tom could be added. This covers pretty much all the fundamental parts of a drum kit.

It's important to note that there is slightly more flexibility than at first glance - such things as a hi-hat pedal don't make sense to be implemented with analogue inputs, it's essentially just a lever to open and close the hi-hats. In this system, a simple switch could be attached to a digital input of the arduino which would modify the message being sent as the 'hi-hat' MIDI note to 'open hi-hat' or 'closed hi-hat'. Additionally, some people just plain don't care about dynamics. For those willing to give this up to have a greater range of instruments, a switch or sensor could be wired to a digital input instead. This would mean that when triggered, the MIDI message would have to contain a preset velocity value. Admittedly the way a lot of records are recorded nowadays (specifically metal!) have bass drums recorded at full blast, or are replaced with samples played at full blast. So it may not be such a bad way of approaching things....

Secondly, I have an FTDI USB to TTL converter cable. Programming with this means the Arduino has no requirement for any extra USB circuitry, this cable just plugs straight in to the header on the side. These cables are quite expensive but handy, and quite quickly reduce costs elsewhere. If you intend to make a couple of projects in this way, you would most definitely get your money back by the savings on Arduino boards. And they're used for all sorts of other stuff too!

Thirdly, it's TINY. Which is awesome. A pic for comparison:



That's a 3.5mm jack to 6.35mm plug converter next to it, the actual plug is around 3cm long. So smaller, simpler hardware and with better analogue I/O. What's there to lose? The craftier among you might have noticed I've not actually soldered the headers - I was testing for size :P With the exam period in full swing, time is at a premium, so all progress on this is sadly suspended until exams are done...

Arduino drum kit, part 2 (The Blastmachine!)

Hi everyone, some more info on the Arduino drum machine...

The state which I left the drum kit in before my Arduino had to be repurposed for university work is covered in this post. The first thing I did was to test how well MIDI works with the Arduino with a simple test from this site:

http://arduino.cc/en/Tutorial/Midi

All the code and stuff in the link above is already in the Arduino IDE under Examples -> Communication -> MIDI.

Sending MIDI messages with the Arduino is very simple. RS232, the standard communications protocol that the Arduino (and all sorts of other things), is almost exactly the same as MIDI. The only thing that needs doing before using simple Serial.write commands is setting the baud rate to the MIDI standard - 31250 baud, which is shown in the link above. The program provided transmits a whole range of notes. The code can be modified to just send one note by removing the 'for' loop and replacing where it says 'note' with the note that you want. This note is in hexadecimal, so use this for reference:

http://www.wavosaur.com/download/midi-note-hex.php

(I may create a better diagram later on)

The example code creates a 'note on' message. This contains the note number, velocity and channel. For those not familiar with MIDI, velocity emulates the speed at which a piano key or any other instrument is hit, therefore bigger velocity translates to louder sound.The maximum velocity level is 127, minimum is 0, which translates to 0x7F and 0x00 in hex respectively. It is standard practise to send a note with velocity set to 0, as opposed to using the dedicated 'note off' command.

In my setup, I'm using a drum sampler within the recording software Cubase. Cubase is full of all sorts of good stuff, but the bit that we're concerned with here is its VST hosting capability. Whats that? Well, a VST is a virtual instrument that can, amongst other things, accept MIDI and output audio. A VST host sets up the environment for providing the MIDI and audio I/O. I'm using Cubase as a host and Native Instruments Studio Drummer as the instrument, but free alternatives exist, and I hope to write something about this towards the end of the project. Because free alternatives are always a bonus, right?

To test this MIDI communications functionality, and with a certain level of control, I hooked together the MIDI output as specified on that example page, a couple of switched and a couple of LEDs...

(CODE COMING SOON!)

In this case, the code waits for an input from the switch before transmitting a MIDI note. There's one button to trigger the bass drum note, and one to trigger the snare note.

I'd like to add - this has been very poorly coded and you'd never try and run a proper drum kit this way, this was just to test the thing. However it had a quite funny side effect - if you hold a button down, it will continually cycle and play the sample very fast. If you hold down both buttons, it will alternate between both very quickly, and essentially emulates a traditional 'blast beat', the staple drum pattern of extreme metal. Awesome! Good example of what I'm getting at here:



Let's compare...




Thursday, 17 May 2012

Arduino Drum Kit, part 1

Hey everyone, heres a fun project that I've sadly had to halt while my Arduino and time was committed to university work.What I hope to do with this blog is write down some more discussion-based aspects of the development, and then when the thing is done, put up an instruction guide or something similar with design files and whatnot.

The basic plan is this - create an electronic drum brain with an Arduino, where the input is a set of piezo transducers attached to some form of percussive pads, and the output is MIDI messages corresponding to notes. This system will send MIDI messages to a computer, which will in turn play the appropriate drum samples.
Sounds very simple... And quite conveniently, the bulk of it is! And most electronic drum kits Ive come across use very similar methods. In fact, wire up a piezo to a jack plug, plug it into almost electronic drum kit you care to mention, hit it and you'll most likely see it work. So the question you may be asking is 'why do electronic drum kits cost so damn much?' well, the answer quite neatly sums up the limitations of my project. Commercial electtonic drum kits generally have these sorts of features:

  1. Nice hardware - racks for the pads to sit on, nice pads made of durable materials, decent piezo sensors, pads with multiple sensors (think ride cymbal pads with bells as well) e.t.c. Made to go on the road!
  2. Large amounts of I/O - allows the user to attach a ton of pads.
  3. On board samples - increases the specification of the system considerably in terms of memory and storage to hold the samples. Anyone who's worked with digital audio knows - storage and fine quality audio aren't the best of friends.
  4. Other digital features - complex interfaces, additional MIDI features, custom patches and sample sets, things that increase flexibility to the user.

In short, these are things that make electronic drumkits nice, self contained instruments that require little external technology for proper operation. For this project - almost none of these things will be included to keep costs as low as possible. But how will it work with no pads, very little I/O and no sound to play?
What this project is intended to be is the very fundamentals of a drum 'brain'. As it happens, most of the features mentioned above are great, but not neccessary. Rather than onboard samples, sounds are sorted on the computer via a drum sampler and VST host (more on that in part 2). Rather than huge I/O options, the limited Arduino analogue inputs will be used. Rather than nice pads, the sensors will be attached to whatever you can tape them to and dont mind hitting! This is a brief overview of the system.

 
Some projected costs, taking the cheapest in each case:
  • Arduino - £18
  • Piezos - can be found for around 30p each. A set of 6 would therefore be £1.80.
  • MIDI cable - around £3.
  • MIDI interface (omitted from diagram) - cheapest I've found is around the £20 mark.
  • VST host - Free!
  • Drum Sampler - Free!
  • Materials - going to attempt to make pads from butchered mousepads initially. Picked up three for £1.
  • Drum sticks - £4 if you're feeling fancy. Any old pen you have lying about, if not.
This sets a ballpark figure of £47.50 - half the price of the cheapest drum brain I can find! Most of these costs are from a quick check online and I'm sure they could possibly be found cheaper. If you've found these things cheaper, that's great! (and let me know!)
A more detailed breakdown of costs will be included at the end of the project.

I hope to extend this system and add all sorts of usefull bits and bobs. Velocity control would be a particularly useful feature,  which I hope to cover later.
Ill be adding more information about this project over the next few days.
Thanks for reading!