Introduction: A Position Sensitive Midi Drum Pad
The SynPad is a position sensitive midi drum pad that you can build yourself using simple materials and tools for around 50 UK pounds (depending on what materials you already have, and how many pads you want to make.) The pad can detect where you have hit it as well as how hard, so that the synth it is driving can change the sound continuously as you strike the pad in different places.
The software I have written to make the sounds is currently linux based, but would not require much work to adapt to a windows or mac environment.
The skills you need are basic wood and metal work (cutting and drilling), enough electronics knowledge to build a simple circuit from the schematic, and a moderate amount of experience with making music on the linux operating system. You don't need any programming experience to start making sounds under linux, but would if you want to create your own synths to make different sounds, or to port the program to another OS.
If you have built one of these pads, or are thinking of building one, it would be good to hear from you.
Hope you enjoy making and playing this instructable!
Step 1: Design
The signals from each sensor are captured by an arduino micro-controller board, which then sends the raw signal strength from each sensor to a computer over its usb cable. When the sensor data reaches the computer, it is interpreted by a python program which calculates the coordinates and velocity of the strike from the raw figures, and then maps this information onto midi note and controller values.
What happens next is up to you - if you want, you can feed the midi data into any Linux softsynth just as you would for any other midi source like a keyboard. To make the most of the position sensitivity of the pad, though, you want a synth that will change the sound produced according to the x and y position of the strike. The simplest way of doing this is to use one of the music programming languages like supercollider, csound, or pure data. Some example supercollider synths are in the archive attached to the final step of this instructable.
Unfortunately I forgot to take proper photos of each step as I was building the pad - the ones that I have attached are really assembly photos that show the main parts before you bolt them together. They should give you enough of an idea though to build one yourself.
Step 2: Tools and Materials
You will need the following materials:
- a 30 cm square sheet of 3mm thick aluminium.
- a 30 cm square of thick plywood (e.g. 10mm) for the base.
- a 30 cm square sheet of thin plywood (e.g. 5 mm) for the top frame.
- a small amount of 10mm closed cell foam rubber (enough to make 8 * 35mm discs). I bought some online, but you could probably use the rubber from something like a camping mat or old style mouse pad. Soft (open cell) foam of the sort you get in cushions probably wouldn't work.
- 8 * 5mm machine screws, around 55 mm long (and matching nuts and washers). If you can, get the kind where the nuts have a plastic insert to stop the nut from loosening.
- 4 * 35mm diameter piezo transducers.
- 4 small metal discs a bit smaller than the inner contact of the piezo. (E.g. 4 one pence coins).
- Some 30 Awg wire (i.e. v. thin) to wire the piezos.
- Some shielded 1 core cable to carry the signal from the piezos to the arduino.
- Contact adhesive which will stick rubber, wood and metal.
- Epoxy adhesive.
- Gaffer tape.
- 4 * 1 MOhm resistors.
- 2 * 10 KOhm resistors.
- 1 * 100 Ohm resistor.
- 1 * TS912 Op-amp.
- 1 * 2N3904 npn transistor.
- A breadboard or piece of stripboard to build the circuit on.
- Solder.
- Miscellaneous jumper wires.
- An arduino board and usb cable. Any of the arduino boards will do - you just need 4 analogue inputs.
- Magic marker for marking the aluminium sheet.
- Saw to cut the plywood sheets to size.
- Pad saw / fret saw with metal and wood cutting blades. This is for cutting the central hole in the top frame. You only need the metal cutting blade if you need to cut the aluminium sheet to size.
- Electric drill.
- 5 mm wood drill bit.
- 10 mm metal drill bit.
- Large wood drill bit for making the initial hole to use the pad saw through.
- Screwdriver.
- Soldering iron.
- Wire strippers.
Step 3: Cutting the Plywood and Aluminium Sheets
Next you need to cut a square hole in the top plywood sheet (the thinner sheet) to make a frame. I was using 35mm piezos (any smaller probably wouldn't work as the rubber would squash too much), and a gap of 5mm around these, making the width of the border of the top frame 45 mm. So the next step is to cut the top sheet into a frame with 45mm width left around each edge. To do this, mark out a line 45mm in from each edge, then drill large holes inside the corners of this square. Then use the padsaw with a wood cutting blade to cut out the central part.
You may want to sand the edges of the plywood sheets at this point to make it look neater.
Step 4: Drilling the Bolt Holes
Each hole is in line with the centres of the piezos, 10 mm from the piezo's edge. This translates to 22.5 mm x 50mm from each corner. There are 2 bolt holes at each corner.
It is easiest if you start with making the holes in the aluminium (which are 10mm), and then use this as a template for the top frame and the base. This way, any mistakes in drilling the aluminium won't matter so much as the holes will still line up. The top frame and base need 5mm bolt holes to match the machine screws. Mark each sheet with an arrow on one edge before drilling to show the alignment, so you will be able to line them up the same way each time.
Step 5: Soldering the Piezos
The next thing is to solder up the piezos. You want to use quite thin wire for the actual connection, then solder this to the thicker shielded cable that takes the signal to the arduino. The smaller disc on top of the piezo is ground, and the larger one underneath is the positive. Ideally, solder the shield of the cable to the piezo's earth and the inner core to the positive.
If you get to the end of the project and find that you have the polarities wrong, don't panic! The current firmware on the arduino only deals with absolute values not positive and negative, so it shouldn't make too much difference.
Once this is done, use epoxy to glue a small metal disc (e.g. a 1 pence coin) to the top of each piezo to provide a bit of clearance above the wires and make a solid contact with the bottom of the aluminium sheet. Make sure the disc, and the glue you use, are only on the top, inner disc of the piezo's ground electrode, not touching the outer disc.
Step 6: Making and Gluing the Rubber Mounts
Then glue the piezos on top of the ones on the base board (again using contact adhesive). Mark the cables so you know which sensor they come from. Top left is 1, top right is 2, bottom left is 3, and bottom right is 4. Tape the cables from the sensors to the base board with gaffer tape, so that they come out on one side.
Step 7: Assembling the Pad
At this point you need to decide how you are going to mark out the playing surface of the pad for calibration later. The pad is calibrated by striking it in different places while running the calibration program. These places are defined in the program as 13 specific points placed on a 5x5 grid (5 lines not 5 spaces). I started by using 1.5cm clearance from the inner edge of the top frame, but if you want to play with sticks (I am now using timpani sticks), you may want to make the clearance a bit bigger.
When you have decided how much clearance you'll need when playing, take the top sheet off again and mark it up with magic marker. You need a 5x5 grid with enough clearance round the edges for you to strike the pad at each corner. It's also handy to label the corners 1,2,3, and 4 the same as the sensor cables.
Now put the sheet back on, put the washers and nuts on the bolts, and tighten the nuts to finger pressure. Check again that there is good clearance around each of the bolts where it goes through the aluminium sheet. You may want to cut the machine screws down to the exact size with a hacksaw at this point. Be sure to do this with the nuts on, or you'll find it hard to put them on afterwards. It would also be wise to blunt any sharp edges afterwards with a small file.
Finally, tighten each of the bolts by the same amount - 3 whole turns works for me. The pad itself is now finished!
Step 8: Building the Circuit
Step 9: Software Setup
Once you have built the pad and the electronics to work with it, the next thing is to attach it to a computer and start making some music!
I have attached all the necessary software to do this under linux in a .tgz archive. If you have trouble downloading this, the latest version is always available here.
If you want to use windows or mac, it shouldn't be too hard to convert the programs if you have some programming experience. (The only system specific bit is the part of the midimapper program which deals with serial input from the arduino and midi output to the internal midi bus. This program is in python.)
Please bear with me and take the time to work through these instructions. The software is in an early development state at the moment, so not as easy to use as it could be.
There are three main bits of software:
The arduino firmware reads the analogue signals produced by the 4 piezos and turns them into raw readings for each strike.
The midimapper receives the strike data from the arduino and converts it into x-y coordinates then feeds these to a software midi port as note on and controller messages (using controllers 70 and 71). The x coordinate is also duplicated in the midi note number of the note on message. The program is in a pretty crude state at the moment - it is a command line program in python which you control using short commands:
The midi messages are read by the supercollider software (which is basically one program but currently in 2 separate files) and turned into sounds which depend on the position and velocity of the strike.
At the moment, you need to start all these programs separately.
First, load the arduino sketch piezodrum2 onto the arduino. You can find instructions on how to do this on the arduino site. You can test it is working by hitting the pad - it should print a string of numbers on the usb serial device every time you hit the pad.
If you have rebooted the computer since you loaded the firmware, you will need to run the script resetty to put the serial port into the right mode to run the midimapper.
You also need to install the pyseq python library for the midimapper to work. There may be a package for your distro, or else see here.
Then edit the midimapper file (mmap.py) if necessary to set the right usb serial port device. Now start this program from the command line. The commands are as follows:
midi - start sending midi events.
stop - stop sending midi events, or stop calibration.
calib - go into calibration mode.
save - save calibration coefficients.
load - load calibration coefficients.
saveraw - save raw calibration data.
calfile - recalibrate from saved raw data.
quit - leave the program.
You have to calibrate the pad at least once before you can use the midi mode. When you start the calibration, the program will ask you to strike the pad several times (5 is good) in a series of points on the grid you have marked out. The names of these points are mostly self explanatory except for 'top left mid', which is half way between the top left corner and the centre of the pad. Same for 'top right mid' etc.
Once you have calibrated the pad, use 'save' to save the calibration data for next time you run it, then 'midi' to go into midi mode. (You only need 'saveraw' if you are thinking of modifying the formula used to map the raw readings into coordinates). At this point you can check the midimapper is working by watching its output in the terminal - every time you strike the pad it should print out the x and y coords of the strike.
Next you can start up the supercollider programs. See the supercollider site for instructions on installing and using this programming language. The easiest way I have found to use it in linux is to use the plugin for gedit. You will probably also need the jack sound system for outputting sounds.
The program 'drummidi.sc' just reads the incoming midi signals and sends them to a synth called 'MidiDrum'. 'synpad.sc' has various suitable synth definitions ('synthdefs') to work with this. First choose a synthdef you like the sound of from the description and evaluate it (i.e. select it in the editor and press ctrl-E). Then evaluate all the code in 'drummidi.sc' - this will start the program running.
The final step is to connect the midi out port from the midimapper to the midi in port for supercollider, using a program like qjackctl or aconnectgui.
Once you have done this, your pad should start making sounds. Celebrate, try making some music, do a rain dance, whatever works for you!
Attachments
Step 10: Final Thoughts
Timpani mallets, which are felt headed bamboo sticks, work nicely with the pad if you don't want to use your fingers.
The midimapper program is a bit crude at the moment, and I'm hoping to develop this further to make it easier to use and add some more features.
The position sensing is reasonably good - about 5% accuracy which is enough to make some interesting variations as you play a rhythm.
I would also like to make a few more pads and work out a way to connect more than one to the computer at the same time.
For playing, I have been putting the pad on a flat square piece of soft packing foam to reduce the amount of interference from external vibrations. This might get incorporated into later designs. It would also be nice to tidy up the general look and feel of the pad, by painting it and putting the electronics in a proper box.
I would like to thank Alaric Best for his ideas on the design, which set me off on the track the current pad is based on.
If you make one of these yourself, it would be nice to know how it went - you can get in touch by sending me a private message.
For more information, and any software updates, see:
highfellow.org/synpad
Good luck!