Adventures in Piano Building

Turning a mouse house into a musical marvel.

by Ramon Yvarra

I’ve never considered myself particularly musical. I flirted with a few instruments over the years but was never really able to coax my body into performing the complex and repetitive motions in proper time. But I was always enamored by classical music, and piano in particular. My grandmother used to play her old upright for me when I was young, and I still remember those songs that brought a smile to my face. Every time I find myself near a piano I’ve wished that I’d learned earlier on how to play one, so that at that moment I could play something fun for those around me.

So it was one day when I found myself in an antique store just idly browsing the shelves, that I was intrigued by a stack of old QRS piano rolls. In today’s age when our digital devices hold thousands of songs, this physical piece of paper was how people over 100 years ago reproduced music on a massive scale. The format pre-dates all our magnetic formats and even computer punch-cards.

I wondered if anyone had ever gone about trying to scan a piano roll to replicate them in MIDI format. I had a few vague ideas of how to accomplish such a thing, so I bought a roll for a mere $2 and brought it home. I started researching various ways of detecting light or perforations in the paper, before I stumbled on examples of other people’s work with roll scanning.

Warren Trachtman’s work showed that there was a vast array of existing files already out there, so only slightly deterred I started thinking about taking the next step of actually converting a player piano into a full MIDI instrument, with the ability to read key presses and accept MIDI input. Again I was met with examples of work by others to do just such a thing, which honestly gave me hope that I could at the very least achieve my goal of replicating that work.

I really liked the idea behind Stanley, so I tried to reach the creators to see what kind of hardware they used to build it, but was dismissed by their public relations contact, claiming that Stanley was all “proprietary intellectual property”. This seemingly boilerplate response turned out to be only partially true, as I soon discovered that Stanley’s main hardware was a conversion kit called a “VirtualRoll”, that was a readily available solution from the Hunt Piano Company.

VirtualRoll valve boards and controller board.

After some discussion with the folks there I was told the VirtualRoll ran about $2300 for the basic system (before shipping and handling of course), and at the time I considered $2300 to be above my budget for the entire project, so I started exploring ideas behind replicating that functionality from scratch. The VirtualRoll seemed pretty simplistic in its design, and its MIDI input was only an analog DIN-4, which would have required that I interface it with a MIDI-USB converter before even being able to output information to it. I was confident that I could build something better, for less. But first I needed a piano.

The Piano

Battered but not broken

Player pianos in good condition can be found anywhere from FREE to thousands of dollars on Craigslist, and after scouring the “For Sale” pages for months I finally found a piano in my area that was in my price range. So in February 2014, $300 bought me a ‘Hobart M. Cable’ player piano from the 1920s from a seller in Campbell. The seller had been keeping it in his music studio for years, but had never fully explored trying to make it work, and he was glad to part with it and skeptical of what I planned to do with it. After $200 for shipping it arrived dirty, dusty, and with a very distinctly mousey smell about it.

Using that first roll I purchased in the antique store, and with no operating manual to speak of I was able to get the piano working using the built-in foot pedals.

A player piano works using vacuum pressure, and a series of bellows connected to hammers that hit each key.

The paper roll passes over the tracker bar connected to those bellows, and with each hole in the roll it allows the vacuum pressure through, to close the bellow and thus the hammer hits the key. Since I didn’t much want to have to sit in front of the piano for it to play, I first found myself an affordable vacuum pump.

Another $300 later and I was able to do a full test of the existing player mechanism.

Now that I was sure that the piano was in suitable working order I could focus on cleaning and doing more to understand how I could replicate the paper feeding mechanism. Again, having no manual to tell me which screws to remove, and what was safe to fiddle with I carefully removed each part and documented where each set of screws went. There was a very thick layer of dust, mouse droppings, and even glass on things. This piano had seen better days.

Top: The array of hammers. Bottom: The back of the tracker bar assembly with tubes, and the array of bellows for each key.

During cleaning I uncovered the source of the distinctly mousey smell. A mouse once called this piano home and made its nest under the minor keys. I was worried for a brief moment that I’d find a mouse corpse as well, but I just found the nest. I found the idea strangely romantic, so I invented a backstory about this mouse who loved music so much that she made her house in a piano, and I decided to call her “Amelia”. Eventually the piano will include more clues about this music loving mouse that “lives” in the piano, like motion graphics, and imagery on the outside panels that depict her adventures with the piano.

Something I found particularly interesting was the old and tiny details I found while cleaning. Like these numbers written by someone almost 100 years ago to help with assembly.

Eventually I was able to remove enough components to give me a clue as to how to proceed with driving the player mechanism digitally. The VirtualRoll for example works by putting a relay-based release valve into the path between the tracker bar and the bellow to simulate the pressure loss created by the hole in the paper.

The Hardware

Since I now saw that the tubes led from the tracker back to the holes in the note assembly, all I would need was a way to control the airflow to those holes. Enter the solenoid valve. A solenoid is an electromagnet with a plunger, and a solenoid release value is one that when energized allows water or gas to pass, and blocks it when not energized. It took some time to find the right one, but I eventually found a solenoid valve that is normally closed, and only opens when energized, just like the piano roll would normally cover the tracker bar holes.

These solenoids were tiny, and required very little current when operated at 12 volts, and at $1.80 each, at a quantity of 100 (88 notes plus spares), plus postage the total came out to $229. Now I wasn’t 100% sure that these solenoids would be able to remain closed at the pressure generated by my pump because I had no way to measure their individual pressure. But I was hopeful that it would all work out.

Top Left: A single solenoid. Top Right: The holes for each. Bottom: The package of 100.

The plastic nub on each solenoid was just small enough to fit into the holes that were once occupied by lead tubing, and the body of the solenoids just wide enough that they would easily stack next to each other without having to be relocated. But first I had to remove the existing tracker bar and 88 lengths of lead tubing.

Very hazardous stuff

Since lead is a dangerous material I had to wear gloves during this process and properly dispose of it once I’d removed it all. Also to make sure the solenoids fit tightly into each hole I had to find the right PVC tubing. But thanks to McMaster-Carr that was easily done. 25 feet of 3mm ID and 5mm OD was enough to fit the barbed plastic fittings of the solenoids and make an easy but tight fit into the holes that held the lead tubing.

Next I had to cut the PVC and fit every solenoid and then place the tubing into each hole.

You can see the tight fit, and that some were required to be higher above to keep them from shifting too much. Also notice how much cleaner the array is now.

Much of this I did in tandem with other tests. While I waited for the solenoids to ship from China I also found the appropriate circuit I would need to drive them. Shift registers are a common component when trying to drive a large number of items digitally, and I knew that I could turn on 8 items at a time and therefore only need 11 registers to control 88 keys. I started out by reading the specifications for the 74HC595 shift register, but the voltage and current supported by that chip was insufficient to control 12 volt solenoids, so I found a higher current chip that looked like it would fit the bill perfectly.

The TPIC6A596 could handle voltages up to 50 volts and currents of about 350ma continuous if all 8 solenoids were active on the chip, which was good because each solenoid was rated at <150ma. Not only that, but it appeared that the chip had built in transistors that protected it from current surges, so no additional components would be necessary. When the solenoids arrived I created a test circuit and used an Arduino to test out driving the solenoids.

Since I wanted Amelia to be a MIDI destination instrument, instead of a custom standalone piece, I needed to find a way to integrate it into existing MIDI workflows, so I began researching what facilities Mac OS X uses to communicate MIDI and I came upon rtpMidi.

The Software

Since Apple has an implementation of this protocol built into Mac OS X (since 2005) I knew I’d be able to use any existing MIDI apps on the Mac to drive Amelia over any TCP/IP network, such as Ethernet or Wi-Fi. Now I just needed a way to use rtpMidi on an Arduino. After a lot of scouring of the internet I found an existing library.

There were only a few issues. The library wasn’t complete. It took a few weeks of communication with the developer, and eventually branching the original source code to fix some of the missing items but eventually I had a (mostly) stable firmware for my Arduino that would talk to my Mac. So the next step was finding the right kind of software to output the MIDI signals to my rtpMIDI session. This ended up being a lot harder than I’d expected, but eventually I found two tools that would be everything I needed.

Rondo is like iTunes for MIDI files, with the added benefit of being able to disable the tracks of a MIDI file as it’s playing. Another tool that came in handy was VMPK.

Using VMPK I could use my Mac as a virtual piano to send notes to Amelia, and using Rondo I could create playlists of songs that Amelia could play continuously.

Top Left: Rondo Bottom Left: VMPK Right: iPad with MIDI Wrench Backmost Window: Arduino Serial Output

Once I got those elements in place I had enough to do a full end-to-end test of my circuit design.

SUCCESS! Once I had this done I knew that all the work up to this point was worthwhile and was going to be scaleable. So now I could begin the long task of putting things back together.

The Reassembly

The first thing I needed to do was re-install all the keys (after cleaning) and do a final checkup on the array of striking hammers. Unfortunately, while I was putting it back together I noticed that some of the notes had trouble striking properly. I removed the entire array to inspect it better and found several issues.

Top Left: Note hammers sitting uneven. Top Right: Bridle strap replacement. Bottom: Hammer assembly and cotton.
Old bridle straps and leftover string bits.

Each note has on it a thin strap called a “bridle strap” that ensures the hammer returns to its resting point when the key is let up. Over the years it looked like several had degraded or snapped, and so I used simple black string to fashion replacements. Maybe later I’ll replace these with real ones, but they ended up working out pretty well.

I also found some very hard and crusty pieces of cotton wedged between a few of the hammers that didn’t look like they were supposed to go anywhere and were blocking some of the parts, so I carefully pulled them out using some needle nose pliers.

Once the piano was back together it was in sore need of a tuning. Between being moved over several cities, and just being old, its notes varied wildly up and down across the spectrum. I found a local tuner who ended up being just delightful.

Tuning in progress

With a tuned piano I could focus again on the electronics.

The Odds and Ends

I knew that I would have to power 88 solenoids at 150ma each (88 x 150 = 13.2 amps) so I found a 12 volt power supply to do the job.

At only $51 for the power supply I was doing a pretty good job of staying within my budget. Next came the PCB design. I had to create a circuit board that would allow easy chaining of the shift registers while also allowing me easy access to the solenoid hookup wires. I found some spring terminals through PHOENIX CONTACT and bought some for both the power connectors and solenoid leads.

PCB manufacturing is pretty easy these days and you have a lot of options to choose from. SparkFun used to have a side business of PCB manufacturing that got spun off and was renamed to OSH Park so I went with them. They have a very easy process. Just upload your EAGLE PCB file and it automatically generates the trace and screen printing layers, with previews and such, and the prices are very affordable for a hobbyist.

One thing I had to keep in mind when designing this board was that because of the power requirements of the solenoids certain traces needed to be thicker than others. You can see in the previous image that the 12v traces to the solenoids are thicker than the 5v logic lines for the shift registers. This also meant that I needed different gauges of wire to power the boards as opposed to delivering power through the junction boxes.

There are many guides online for picking the right wire gauge.

Once the design was completed I had them expiditedly shipped and within a little over a week I had 12 PCBs in hand. After only a few hours of soldering (with a little help from a friend) I also had all the components put in.

After the first round of testing I discovered a few flaws in my PCB design. It looked like when I designed the board one of the traces was accidentally removed, so I had to add a jumper wire to each board. Also the 6-pin connectors I put in were oriented properly, but the traces weren’t re-ordered to account for the rotation of the connector, so I had to make a small change to my cabling. Additionally it looked like OSH Park’s text rendering was slightly different than what I saw in EAGLE, so some of the text was obscured by the components. To route power to each board from the power supply I purchased a few marine style power junction boxes. This allowed each board to have its own distinct power and to split the boards power up between the power supply’s two pole connectors.

Top: Note assembly re-installed. Bottom Left: Single Board. Bottom Right: Power junction boxes.

With all the boards in place, power flowing, and the controller accepting network data it was finally time to put the whole system to a test.

Hurrah! It’s truly a wonderful feeling seeing something you’ve imagined finally come together. But like always, there were a few problems.

The Firmware

Even though I had a working library receiving the MIDI signals from Rondo, I hadn’t fully anticipated the way MIDI notes are laid out in their tracks. I’d already downloaded several files that were scans of the original piano rolls, and the piano played these pretty flawlessly. But other more modernly composed files didn’t perform as well in certain locations. The reason I discovered was that notes intended for a synthesizer were clustered and bunched up in the track data, and so OFFs and ONs would happen at the same point in time in the file. Because of this the solenoid (and thus the bellow connected to it) wouldn’t even have time to open and close. This meant that notes that were clustered together were skipped and so the songs didn’t sound right on the piano. Now the Arduino Mega 2560 only has about 8KB of RAM, and I had no idea how much of that I had available after the MIDI library was loaded and dealing with incoming notes over Ethernet. But I had to figure out a way to buffer the incoming information, so that I could introduce breaks or rests in the playback to allow the keys to recover after being sent an OFF message. This took some tweaking and listening to songs repeatedly, but eventually I was able to get it performing correctly.

Visualizing the MIDI timing problem.

The Display & Visualization

Part of my original concept for Amelia was for there to be a screen where the backsplash piece was. With a display the piano could be extremely expressive and interactive. My initial thoughts were to use a few micro projectors and rear-project onto a frosted plexiglass surface, but after exploring that idea I discovered that the necessary distance to display an image large enough would have been deeper than the piano. So I opted for a more conventional LCD screen. But first I had to find a display of appropriate size. There are many LCD manufactures out there that offer screens in a wide array of sizes to fit various needs. I finally landed on a reseller for a Taiwan LCD manufacturer called Litemax.

They had a wide array of display sizes, but the one that fit my needs was the SSH4913-ENN-H01 (now discontinued). At 49.5" x 15.25" it would fit perfectly into the existing frame while leaving just enough room for a bezel and mounting hardware, which meant that I also had to do some woodworking on the original wooden pieces.

A few measurements later and I had a plan for modifying this irreplaceable part.

CAD Diagram of the needed work.

I wanted the display to sit into a recess that would allow me to mount it into the wooden piece snugly and without much additional hardware. After a quick trip to Home Depot I also had enough clamps, guides, and power tools to do the job. I used a jig saw to do the initial cut and then built a jig to help my router cut the pocket into the piece.

Top: Initial jigsaw cut. Left & Right: Inspecting the router progress.

My inital cuts were pretty horrible as I’d never used a router before, so there was a great deal of re-measuring at every stage. The jig was absolutely necessary to help maintain straight lines. After a bit of sanding and fine work with an exacto knife I finally had a frame that fit my display.

The grey metal is still visible.

After fitting the display into the frame I realized that some of the metal frame was still visible, so I used a black sharpie to black out those parts and to black out the edges of the wood to provide a more finished appearance. I may go back later and try to put some trim on it to make it look more finished.

I’d been working on the visualizations in the down time while I waited for parts to arrive, and using Processing I was able to quickly put together about 10 different display modes that I thought looked fun and engaging.

Angled Slashes Visualizer
Triangle Noise
www.icloud.com

In the videos above you’ll notice that the piano isn’t playing in them, and that’s because I had them completed before the PCBs had been installed, and so my laptop is generating the sound and MIDI notes that get interpreted by the visualizer.

The Transportation

Getting an 800 pound piano from place to place is tough. The 90 year old wheels on the bottom of the piano had long since rusted to a point of uselessness, and to my surprise there weren’t a lot of easy options for moving a piano of this size. It turns out that most commercially available piano dollys went for hundreds of dollars, and wouldn’t fit a piano of this size. So I had to design them myself.

After a quick visit to the local caster store I purchased 4 casters that I was told would be appropriate for my purpose of moving over concrete and harder surfaces. The ball bearings in them make the piano glide easily with only one person moving it.

A fellow maker friend of mine helped me out by doing the metal fabrication and welding. Without this critical piece all the work up to now would have been almost impossible to move around.

The Final Reveal

During the build process I was approached by some friends who were putting together an interactive art exhibit in Oakland California called FIGMENT, and was asked if I wanted to contribute anything to the event. I realized that this would be a perfect place to finally reveal Amelia. I’d been working on the project since February, but the pace was slow and I had no real deadline until I committed to FIGMENT. I spent the better part of September and October getting all the final pieces together and finally revealed it to hundreds of attendees.

Video by YouTube user crapple0
Video by Instragram user tasquin
Video by Instragram user figmentoakland
Photo by Calista Chandler

The End of Phase 1

From the beginning of this project I wanted Amelia to be a fully dynamic MIDI instrument, accepting MIDI information as well as outputting it. So the next phase of the project is to build a key scanner underneath the keys so that it can detect when keys are pressed. So I’ll be working on this for 2015 when I hope to showcase Amelia at the local Maker Faire.

Thank you to all those fellow makers, companies, and communities out there that make building things like this only a matter of time and determination.

-R-

The Adventure continues in Part 2…