Wednesday, July 09, 2008

creating a piano keyboard using scratch

One of my year 10 students showed me the basics of how to do this. I then asked him to teach it to the class.

When you mouse over the Scratch 'play note' tile drop down keyboard the key identifier, such as C, pops up, with an associated number. This pop up feature makes it easy to obtain an overview of a music keyboard even for someone like me who knows very little about music notation.

You can map this piano keyboard onto the computer keyboard using Scratch sensing, sound and control tiles, shown below:
Then map this onto two rows of the computer keyboard, using the middle letter row for the white keys and the top letter row for the sharps and flats

One problem is that there are 15 white keys, so there are not enough keys in one row of the computer keyboard for all of them. My workaround here was to use the space key in combination with the middle row letter keys to fit all 15 keys into the one row. The pictures just show the method for upper C and lower C:

I could take this a step further by making lots of versions of the image below showing individual keys being depressed and then mapping those images to synchronise with playing the computer keyboard. I'm thinking of writing that up as a project for the class.

At this stage, the task I have set my students is to make the cat or some other sprite dance in interesting ways as they play a tune.

No comments: