Tuesday, July 22, 2014

Piano Man

Today I have something I am very proud of. I don't remember what made me want to do this, but I decided to make a piano. Now, I'm on vacation from work so I've had a lot of time to do nothing but Minecraft. :D
As a result, I built 3 pianos yesterday and then today I built the zenith of my Minecraft pianos. 

The first piano is one that any player can play around on. If they step on a key, it will play that note. I guess this was probably inspired by the floor piano at FAO Schwarz. Here's a great video of the employees playing Toccata and Fugue in D Minor by Johann Sebastian Bach on the floor piano: Floor Piano.

Minecraft has some limitations, but I'd like to see some people work together to try to play a song on my piano. :D

Here is the first one I built. At first it used pressure plates that you stepped on to press the keys. That was really ugly and made clicking noises whenever you stepped on or off of the pressure plates, so I changed it to where now there is a clock (a repeating pulse of "electricity") that checks if a player is on a key and then if they are it plays that note. Pretty simple, not too sophisticated, and it can cause some lag because of all the stuff under the hood. Not too bad, though.

 

Here is the inside of the piano. The clock is the glowing thing halfway down the box. If you don't know much about redstone components then the rest won't make much since to you. That's ok, just move along to the next bit.


Here is the second piano that I built yesterday. I wanted to make one of those player pianos that plays itself at the push of a button, so I built this. This one actually has the keys depress when the note is played, so it really looks authentic. This model is just one of the first iterations, however. The player pianos get better with each one. They keys work by being attached to sticky pistons which are kept fully extended until that key is played. The problem with this is that pistons are very noisy.


This view from the top allows you to glimpse into the belly of the beast.


Now we're really getting in there. This player piano works by having a ribbon feed that tells the piano which key to play at what time. The red bits are the notes for the left hand and the green ones are for the right hand (if you were really playing on a piano). 

... Ok, where was I? An ice cream truck came by and I had to go get some, for nostalgia's sake. Alright, back to the pianos.

This player piano and the one after it play "In the Hall of the Mountain King", which is a song I personally love and can play on the guitar (picking, you know. I can't actually play piano.) One of the problems with this piano is that the ribbon can only feed through at one speed, and that speed is slow. The ribbon is cycled through with the use of 25 pistons at each of the four corners. If I set the clock too fast, the pistons won't retract fast enough to get out of the way of the incoming blocks and the whole system will get blocked up (pun intended). 


I built a glass walkway for people to go inside the machine and see the cogs in motion so to speak. I actually really like this picture, I think it turned out pretty cool looking. I am on the  walkway inside the ribbon cage.


This is the "processor" if you will. The current is always on, but it only pushes through to the other side when one of the red or green blocks is in front of it. The glass does not allow current to pass through it, so if there is glass, the note will not play and the key will stay in it's default position, which is up. If one of the red or green bits is in front of it, the current will travel through, sounding the note and causing the pistons to lower the key.

By the way, each vertical strip of the ribbon corresponds to a note on the piano, so the two red blocks on the right side of the picture will both play the F# below middle C, but will do it four beats apart. The left hand part seen in red alternates between F# and B on beats 1 and 3 as you can see by the red bit just a few blocks down the ribbon tunnel.


Alright, here comes the player piano version 2. This one is also supposed to play "In the Hall of the Mountain King" but I never finished programming the song into it. The building and designing of this piano was a long and tedious process and, as usually happens, partway through the very last step I realized a better way to do it. I said to Rob, "Rob, I just thought of a way to do it better. Now I've got to build another one. He keeps asking me, "How many pianos is it that you've built now?" I've only built four, so calm down. Anyway, I didn't possess the fortitude to carry this one through to the end. Either way, let's see how it's supposed to work.


This one works by a string of delayed current that passes through blocks that play the note, press the key, and lift the last key. This one is vastly better than the last model for several reasons. It doesn't use pistons, so there's not that annoying clicking sound constantly interfering with the music. It doesn't have the same ribbon as last time that limited the song to 46 beats. It can also have varied delay between notes, allowing for near proper timing of the music. It doesn't cause as much lag either, because it doesn't have any sort of clock. When the button is pressed, the song plays through from beginning to end through the string of blocks which play notes and change which keys are pressed.

The problem with this design is that I had to program each block individually and also each note. This means that I could have mixed up some of the programming so that a different key is pressed than the one that you hear. Also it takes forever to make, which is not a good thing. Additionally, it can only play one song, and that song takes forever to put in. If I wanted to change the song, I'd have to rebuild the entire thing.


Finally, we have the 4th and final piano. This player piano is better in every way, but could still improve. However, since I've been making pianos for two days straight, I think I need to move on to something else. I was told that pianos needed to be made out of wood, so I made this last one out of wood and it turned out really beautiful I think.  
 

Here is the replacement for the old ribbon style of song programming. This has a delayed current that runs through once when you push the button. As the current goes through, the blocks communicate to the main processor which note to play and the processor (for lack of a better term) takes care of the rest. This means that I don't have as many opportunities to mess up and the key being pressed will always match the note being played. Another great thing is that this one is designed to be easier to set the timing for. The last one caused some difficulties and the space was too busy and confined.

Probably the best thing about it, though, is that it's easy to put more songs into this piano. It takes significantly less time than the other two models, and I can have more than one song on the same piano. If I ever end up adding another song to this one, I'll probably make it so only one song can play at a time. Otherwise that would sound cacophonous. By the way, this piano plays a simple version of Fur Elise, which is another great song that I can also play on guitar.
 

This is the "processor". When the ribbon tells it what note to play, it plays the note, presses the key, then lifts the key after letting it stay down for a short time. On the last model, I had to do all of those on every beat. This is a vast improvement. It's also fun to watch this part of the piano when a song is playing. 



Ok, we're at the last picture. This is a picture of the piano playing Fur Elise. It's not really something that comes across very well in a picture, but I wanted to show you what it looked like when a key was pressed. If you look to the right of the picture behind the piano, you can see the ribbon lit up. Judging from where the current is, the song is almost over. I did just the first part of the song, so it goes by pretty quickly. I could add more if I wanted.



Here is a video of the piano in action:


And here is a video explanation for how it works in case you'd like to build your own or if you're just curious.



That's all folks! Thanks for reading!


No comments:

Post a Comment