piano

Trying to program a piano staff/stave. Is this what it's supposed to look like?


I'm currently writing a software application which creates notes on a staff, when a piano key is pressed. Unfortunately I have no background in music, and thus am finding it quite hard to get started.

Could someone kindly tell me if the following screenshot represents what it would look like on the staff (approximately) if someone presses all the white keys on a 25-key keyboard (15 white, 10 black) from left to right, and then from right to left?

Am I on the right track, or is this completely wrong? (The notes are just displayed as circles for now - im trying to get the positioning right).


Solution

  • Almost. You need a few extra things. (NB. This is a simplified list just to get you going. Music notation is a complex beast that can take years of study to master)

    1. A Clef. Presumably in this instance you're looking for a treble clef.
    2. You need to imagine that there are invisible lines (ledger lines) above and below the 5 you can see. In your example, the very first note played is immediately below the first of the invisible lines at the bottom, so you need to draw that as part of the note. (See the example on the wikipedia page I linked to.)
    3. Obviously, note duration is required, but you mention you're already on that so I won't talk about it here.
    4. A Key signature to tell the player what key the music is in, and therefore what sharps and flats to expect

    There's a lot more to drawing music on a stave than meets the eye, I'm afraid, but these should point you in the right direction.