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.

[youtube=http://www.youtube.com/watch?v=lXECSFnu9yg&w=470]

22 thoughts on “Reading Piano Rolls Without A Player Piano

  1. 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.

    1. 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.

        1. It’s not like you “Need” it. It’s just a lot easier than the alternatives. The originals likely used some mechanically operated parallel cutting machine that cost boatloads of money.

          1. Easier? not really if you have the special metal template plates that can be fixed each page of “fan fold”. Templates had holes in all possible positions so the composer simply pushed a sylus(or pencil) through the appropriate holes and the metal plate would ensure any holes would be located properly. To copy a piece would have used similar methods to copying instructions for a Jacquard loom.

    2. 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…

  2. 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

    1. 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.

      1. 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

  3. 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!

    1. 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.

  4. I have an old player piano, that I want to get rid of for space. But when I started playing it today, I wondered if anyone
    has invented a machine that can play the old rolls without the 2 ton piano? Looks like one guys was on the right
    track, being able to reproduce the rolls digitally. I guess if there were a machine that you could put the rolls in and
    they would be automatically converted digitally that I could put on a memory stick or?? I know that would kind of
    take the fun out of the physicalness of the process of playing, but a machine that you could put the roll in and
    get the same results as pumping ( getting more difficult with age )

Leave a Reply to HirudineaCancel reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.