Reading piano rolls without a player piano

detection-example

A while back, [Jacob] played around with a player piano. After feeding a roll into the machine and trying to figure out how a fifty year old machine using hundred year old technology can replicate a skilled pianist, he decided to take a crack at decoding piano rolls for himself. He came up with a clever way of doing it over Christmas break, using a camera and a few bits of OpenCV.

The old-school mechanics of a player piano use a bellows and valve system to suck air through dozens of holes, making the action hit a string whenever a hole is present in the piano roll. To bring this mechanism into the modern age, [Jacob] pointed a video camera at the active part of the piano roll and used OpenCV to translate holes in a piece of paper to a MIDI file.

The synthesized version sounds just as good as the original paper scroll-based version, as seen in the video after the break. There are a few sync issues in the video and the resulting MIDI file isn’t in the right key, but that’s easily fixed by anyone willing to replicate this project.

Comments

  1. Matt says:

    Thanks for a great hack. My grandparents used to have a pedal powered pianola, brought back great memories of pushing the pedals with my hands as a kid cause I was too short to reach the pedals when sitting on the seat.

  2. t&p says:

    The song seems better that wrong key

  3. Hirudinea says:

    Now he just has to figure out a wat to print out new piano rolls, maybe modding an old dox matrix printer, than and some way to keep the RIAA off his ass.

    • 0xfred says:

      Creating new rolls shouldn’t be too difficult. You’d just need a laser cutter – and of course a way to feed the paper through if you wanted a reasonable length of roll. It’s similar to the way I got an old Fisher price record player playing Stairway to Heaven (that was posted here a while back) only with more notes available.

    • Jacob says:

      I really do want to create a new roll–maybe make this old fart play some Zelda music or something. I don’t think I’ll be getting my hands on a vinyl cutter any time soon, or even a laser cutter, but I think I might be able to just punch a hole with a stylus and that’d be good enough…I’ll have to think on this a bit more…

  4. arfink says:

    I love the way he formatted his video If makers and hackers everywhere could make videos like this, it’d be a wonderful thing.

  5. Eric Mack says:

    Well done. If you google, there are guys out there that have built CNC punching machines for piano rolls as well as readers.

  6. stevebb says:

    It ain’t always as simple as “hole maps to played note”. there are a number of different formats the information can be encoded in, eg English and German (fairground) machines can have up to 5 “manuals”(a manual is the name for a IO device of a music keyboard- 2 channels per manual ie left and right hands) a means was found to compress the information so less columns of holes would be required. kind of like defining a macro for a chord, and play the macro on channel x. also commands to transpose chords up and down a scale, add sustain etc – the maths of such transformations ain’t that difficult, and it’s not that difficult to implement it physically

    • Jacob says:

      That’s very interesting. Is there a place I can read into these more complex machines? I really know very little about this one…just made a quick observation and ran with it. Sounds like these machines you speak of are works of art.

      • stevebb says:

        unfortunately I know very little about the internals of those machines knowing more about how the music pieces could be the physically transcribed for such machines, Got this information from my partner, who had an very elderly relative who used to run a collery brass band, and who had a (very) expensive, multichannel piano roll driven hapiscord that he used to practice writing his own compositions on. I’m not good at music theory- but my partner is, and she distictly recalls him editing existing pieces by adding a single hole that would tweak the position of a chord. – only way that could be done is if the infomation about chord selection, and position of chord on the scale were encoded seperately on the piano roll. I’ve got a few ideas how specialised multiposition valves might have been able to do that but I’ll have to think about it and as look up to see if anyone has more certain info

  7. Paperwasp says:

    Years ago I bought an old house that included many of its furnishings. There was an ugly old upright player piano in the living room. It was still plugged into a wall outlet. There was a role still attached, so I flicked a few switches and the motor in the piano began rumbling away loudly. I remember a very musty, oily smell coming from the piano. Kind of like a hot electric motor smell. I bopped the piano mechanism with my fist several times and the thing began playing a very slow rendition (and horrible sounding) of “I Love You Truly.” I shut the thing off and said to my wife, “This thing has got to go.” The piano was ugly visually and sounded ugly. I couldn’t give it away, and a disposal fee was to have it removed from my house to was too expensive. A buddy of mine and myself removed the half ton harbinger from my home out to a gravel lot in the back of my home. The easiest way to dispose of the piano was to set in on fire. That I did (safely) and it burned very quickly. I came to realize what fire hazards old pianos are! Boy do they burn easily!

    • Ed says:

      Why didn’t you post it for sale on Craigslist? These things are hard to find and there are plenty of collectors. You set it on fire? That sounds like a very idiotic thing to do.

  8. Shereen says:

    Very nice song and amazing way to produce sound from this machine

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 92,138 other followers