Author Archives: Joe

Hydrogen

After configuring QjackCTL and ttyMIDI you will be happy to know that Hydrogen is the simplest of all three to get running. Install it using Ubuntu Software Center. Launch it and tap your piezos. That’s it!

I’ll include a few screenshots and some changes that I’ve made just in case you want to verify or customize your own setup.

Tools > Preferences > General Tab
Hydrogen-General

Tools > Preferences > Audio System Tab

Hydrogen-AudioSystem

Tools > Preferences > Midi System Tab

Hydrogen-MidiSystem


You should see the MIDI-IN button light up in the toolbar when tapping the triggers.

Hydrogen-MIDIBtn


Customize a DrumKit
In Hydrogen, select the Sound Library tab on the far right of the screen about halfway down the page. By default the first six drums in the GMKit Pattern 1 will be mapped to the DrumKit Kit AI triggers. I like to keep the GMKit as is so I can refer back to it later. To create a custom kit select Instruments > Save library and give it a name. Once saved you will see your new kit displayed in the User Drumkits under the sound library. This is an easy way to copy the existing drumkit instead of building a new one from scratch.
CustomKit1

Right click your custom kit and select Load. Your custom kit now displays in the left pane. Then drag and drop, add and delete the drums until you like the way they map to the triggers. Follow the same steps to save your new kit, but give it the same name as you did before instead of renaming it.
CustomKit2
CustomKit3

ttyMIDI

ttyMIDI is an application that recieves MIDI signals through the USB port on your computer and sends them to a MIDI program such as Ardour, Hydrogen or GIMP.  In this project I am using ttymidi to receive MIDI signals sent from the Arduino DrumKit Kit AI and send them to the Hydrogen application.

Installing ttyMIDI

  • Go to the ttyMIDI project page at https://launchpad.net/ttymidi
  • Click the link Browse the code
  • Download the entire directory
  • Use a terminal to navigate to the directory
  • The directory contains a folder named src and a file named Makefile
  • Type make in the directory you are in to compile the ttyMIDI source code
  • The program depends on libasound2. Type apt-get install libasound2-dev
  • Type sudo make install to copy the compiled file to /usr/bin for easy access
  • To connect to ttyUSB port at default speed (115200bps) and display information
    about incoming MIDI events type ttymidi -s /dev/ttyUSB0 -v
  • Tap a trigger to see MIDI events in the terminal window

When tapping a piezo trigger you should see a light blinking on your DrumKit Kit AI board. You should also see a number of lines output to the terminal window. One of the lines should read

Serial 0×90 Note on 008 036 024

This means you are recieving MIDI notes in ttyMIDI. With the proper JACK mappings you should hear sound coming from your speakers.

GETTINGS ARDUMIDI ERRORS?

arduino-erros

Depending which ttymidi version you downloaded you may notice errors compiling when you use the #include ardumidi.h. In this case you need to make some changes to the files. The fixes are supposed to be made in the latest release, but just in case…

In ardumidi.h:
replace #include WProgram.h with #include "Arduino.h"

In ardumidi.cpp:
replace #include WProgram.h with #include "Arduino.h"
replace all occurences of Serial.print(value, BYTE); with Serial.write(value);

QjackCtl

Jack is a software package that connects a number of different applications to an audio device, such as your computer speakers, as well as allowing your applications to share audio between themselves.  Jack runs on GNU/Linux, Solaris, FreeBSD, OS X and Windows.

QjackCtl provides a graphical user interface to control the Jack sound server daemon.  QjackCtl is specific to the Linux Audio Desktop infrastructure.

I use QjackCtl to bind the MIDI signals received on ttymidi to the drumkit sounds in Hydrogen which output to the computer speakers.  Below are installation and configuration instructions for QjackCtl.

Install QjackCtl:

  • Using Ubuntu Software Center search for QjackCtl and select Install
  • Using the terminal: sudo apt-get install jackd qjackctl

Configure QjackCtl:

Start QjackCtl from Applications > Sound & Video > Audio Production > Jack Control

QjackCtl displays a message window to show you log messages.  You may see xrun errors and other output that can help you understand problems with your installation that are keeping QjackCtl from running optimally.  This image is a quick view of my QjackCtl Settings.

JACK Audio Connection Kit

The objective is to get the Latency to its lowest setting possible without experiencing xruns.  Installing jack on a real-time operating system such as Ubuntu Studio will help reduce latency.  There are a number of tweaks you can do to your system to run jack in realtime. My installation runs fine without the tweaks, but they may be useful depending on your environment.

Once jack is running without xrun errors you can start sharing audio between applications.  To get ttymidi to send output to Hydrogen with the help of Jack, start QjackCtl and open the connections window.

Click on the MIDI tab and expand the system option under Readable Clients and Writable Clients.  The two connections that are present are the Jack capture and playback options.

Jack-connect1

Next start ttymidi and notice the two new connections that appear under the MIDI system clients.  midi_capture_2 and midi_playback_2 belong to the ttymidi application.

Jack-ttymidi

Start Hydrogen and notice the newly added midi_playback_3 option listed under Writable Clients.  Highlight midi_capture_2 and midi_playback_3 and click the Connect button.  This tells jack to take the input from ttymidi and send it to Hydrogen.  Any time you restart ttymidi or Hydrogen or make any changes in jack you will have to run through this process again.  The numbers will change so you need to watch the Connect MIDI tab when starting your programs to make sure you are connecting the correct capture and playback options for the desired applications.

Jack-Hydrogen-connect

Select the Audio tab and make sure Hydrogen is exporting sound to the speakers by connecting out_L to playback_1 and out_R to playback_2.

Jack-Hydrogen-audio

If everything is running and connected properly you should now be able to tap a trigger and hear sound coming from your speakers.  Read my posts on ttymidi and Hydrogen for installation and configuration instructions.

The Arduino DrumKit Kit AI

The DrumKit Kit AI (all inclusive) is a specific type of Arduino platform that receives signals from piezo sensors and transmits them as MIDI signals.  You can purchase the DrumKit Kit AI from SpikenzieLabs.com in three different forms.  Unassembled – which means you have some soldering in your future.  Assembled – you’ll be buying the cables and piezo sensors separately.  Bundled – ships with cables, sensors and the Arduino board preconfigured with the software (called a sketch).

An overview of the DrumKit Kit AI (literally):

DKK-parts1Image from SpikenzieLabs.com

While this is a lot of information for an image there are really only two important parts to note.  The “screw terminals for pads” is where you can connect up to six piezo sensors which recieve beats from the drums.  The “FTDI connector” is used to send MIDI signals to your computer via the USB port.  The FTDI connector powers the board so you don’t need to connect the power cable if the FTDI is connected.

The DrumKit Kit AI ships with a sketch already installed.  Once you get qjackctl, ttymidi and Hydrogen running on your Linux machine you should hear drum beats from most if not all of the sensors. I didn’t have much luck with this so I installed a new sketch.  To do so you need to download the arduino software.  Then download this working_sketch and open it with the arduino software to view the changes.  The PadNote values match up to the screw terminals from left to right.

I added the line #include <ardumidi.h> and change the PadNote values to {36,37,38,39,40,41}. These are the values of the first six drums in Hydrogen.  Drag and drop the drums in Hydrogen to order them the way you want.

It should look like this
drumvillian_sketch

To upload your sketch to the board select File->Upload or click Ctrl+U.  If you receive errors while uploading then check that no other programs are tied to your USB port.  For example, ttymidi cannot be running or you will get an error when uploading a new sketch. For more troubleshooting, see my ttymidi post.

Once your sketch is uploaded, close the arduino program and start ttymidi.  Then tap some of the sensors to see what type of messages you are receiving.  If all goes well you should see Note on values.  Those Note on values will create a sound once you have ttymidi, qjackctl and Hydrogen working.  For now a Note on message is a good sign!

Building the drum

To build the drums I followed the steps on edrums.info.  Home Depot had most of the materials I needed.  A 4′x8′ section of 3/4″ Oak Veneer plywood cost about $45.  Before buying a whole sheet and all of the materials to build a full drum kit I recommend you purchase only as much material as you need for a single drum.  You will learn a lot when building your first drum and probably find better ways to build the remaining drums.

DrumKitParts

This image shows the materials I purchased to build a complete kit.  I took measurements with me to the store and had them cut the plywood into 5 pieces of differing sizes.  Four cuts with a 1/4″ width blade gives you 95 inches to work with instead of 96.  I had them cut the boards to the following sizes:

Board Width Drums Made
26″ wide cut Makes two 22 1/2″ circles – Bass Drum
22″ wide cut Makes two 18″ circles – Floor Tom
One 10″ circle – Splash Cymbal
18″ wide cut Makes two 16″ circles – Snare Drum
One 14″ circle – Top of Hi-Tom
15″ wide cut Makes one 14″ circle – Bottom of Hi-Tom
Two 14″ circles – Mid-Tom
14″ wide cut Two 14″ circles – Low-Tom
Various sized cymbals

I didn’t have a router and circle jig so I used a jigsaw instead.  The circles aren’t as crisp, but it got the job done.  Instead of cutting the inside diameter of the circle to fit over the top of the bucket I simply cut the diameter of the inside circle to fit exactly around the top of the bucket.  The screen is still taught once the bolts are tight.

The router would have come in handy to cut a ring in the bottom circle for the bucket to sit in, but I skipped that part too.  The bolts between the top and bottom pieces of wood have enough pressure to keep the bucket in place.

Everything else went according to the instructions and the final outcome looks like the image below.
SnareDrum