4

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

3
  • 2
    Your vertical spacing is a little wiggly: make sure you're rounding the device coordinates. If the "space" notes can't be perfectly centered, they should hug closer to the line below (gravity). Commented Dec 14, 2011 at 7:14
  • 4
    You need a reference on musical notation; the one I always have next to my monitor is the Essential Dictionary of Musical Notation, published by Alfred: amazon.com/Essential-Dictionary-Music-Notation-Practical/dp/… Commented Dec 26, 2011 at 14:03
  • There are many free programs out there that can take MIDI files and make a really good job at producing readable pages that have taken many thousands of man hours to program. I tried the same thing as you about 20 years ago, and I thought I was making good progress until I hit problems like positioning clefs and repeat signs, and when to break slurs and ties at the end of a line or page etc etc. It's good fun, but I think you will find it gets very difficult very quickly. (I only just realised this was asked 8 years ago - how did you get on?)
    – Neil
    Commented Aug 23, 2019 at 14:09

6 Answers 6

10

The vertical positioning is almost correct, although every dot should be either exactly between two lines, or exactly vertically centred on a line. The top F is OK (assuming this is a treble stave) but by the time you reach the E at the bottom of the clef, positioning errors have accumulated and it's difficult to tell at a glance where the note is supposed to be.

Horizontally, I would say that a musician would normally expect the notes to be more widely spaced.

Typesetting music is analogous to typesetting words. You can reasonably easily come up with something that isn't "wrong", but is the music equivalent of a printing an essay in Courier New.

You can go a step further and get something that's the musical equivalent of using a nicer font, but being naive about kerning and aliasing.

To get something that's comparable to a professionally produced score -- or the typesetting of something like TeX -- that's the domain of people who are both extremely talented software developers and musicians and to some extent artists.

Most software that produces stave output doesn't aspire to that level of quality, mind you. Stuff like GarageBand or Cubase is somewhere in the middle. Lilypond aims high, but acknowledges that perfection is a long way off. Sibelius aims high, and gets the brightest and best to work on it.

0
10

You are not completely wrong.

  • The size of the dots needs to be larger, so that one note fits exactly between two lines.
  • The notes must be exactly centered on a line, or fitting exactly between two lines.
  • The dots should not be circles, rather tilted or skewed ellipses. See the examples at http://en.wikipedia.org/wiki/Musical_notation .
  • The notes lower than the one below (but touching) the lowest line must have ledger lines (see ledger lines on wikipedia). Same thing above the staff.
  • If you need to notate rythms, the distance between dots is dependent on the length of the tone, but not quite proportional. The rules are very complicated there, and somewhat subjective. If you only need to notate pitch, you should space the dots a bit more for readability anyway.
  • You need a clef. A dot at a given position does not always mean the same, depending on the clef. See Clef on wikipedia.
3
  • I'm not sure, but whether it's drawn as an ellipse or a circle shouldn't matter - more of a style thing I think. Maybe ellipses are slightly easier to read. Commented May 29, 2012 at 0:24
  • I have yet to see any printed material with circles (or rather discs), I have only seen that in beginners' handwriting.
    – Gauthier
    Commented May 29, 2012 at 11:54
  • 1
    Agreed, and I wouldn't be very impressed by printed material that didn't use the elliptical shape. Just saying it's not essential for comprehension; certainly not as important as placement. Commented May 31, 2012 at 3:25
10

You are trying to find simplistic answers to a relatively complex subject. At the very least you should go to a music store and purchase a beginning piano book or a beginning music book for children or adults and study the basics of how music is notated.

By way of example, I do not think you would be successful at writing a computer program to display Chinese calligraphy on a computer screen if you were completely ignorant of how brush strokes are used in Chinese characters, and you thought you could accomplish the task without learning the basics of Chinese brush strokes.

Read a book or consult with a piano teacher.

And with regard to your diagram, you have failed to distinguish which octaves your 25 pitches are located in. This must be designated by the correct clef signs and ledger lines. Furthermore, piano music is notated on two staves, not one. Here is an example.

enter image description here

2
  • 1
    Good example. If he wants real challenge/kick in the pants, I'd suggest the first few chapters of Paul Hindemith's "Elementary Training for Musicians".
    – NReilingh
    Commented Dec 24, 2011 at 23:29
  • 1
    It's important to note that in most contexts even when one has a treble and bass cleff adjacent to each other, a melodic line which starts in the treble cleff and descends down a little below middle C and then goes back up will often be notated using ledger lines attached to the treble cleff, and likewise with the bass cleff for lines which go slightly above middle C and go back down.
    – supercat
    Commented Jan 26, 2013 at 0:20
10

As a pianist I balked immediately upon seeing your image, mainly because the notes do not have exactly the same diameter as the vertical distance between the lines; and some of the notes do not line up perfectly centered on the line or in the space between.

The absolute worst is the 4th and 5th dots from the left. One seems to be hanging off the bottom line, and the next is sitting on top of the line; both are very ambiguous.

Each note must:

  1. have a vertical height equal to the vertical distance between two lines of the stave; and preferably have the same width (or perhaps slightly wider)

  2. be either vertically centered on a line (e.g. for E, G, B, D and F, if this is a treble), or touching but not overstepping both lines (e.g. for F, A, C and E). For notes outside this range, the note should be positioned as if there were extra stave lines to hold it - and indeed, for notes lower than D and higher than high G, you must add extra horizontal staff lines (ledger lines) for that note. See for example: http://en.wikipedia.org/wiki/File:Cifrado_americano.JPG

enter image description here

To test your scheme, you should generate a random series of notes (not in the smooth progression you have there) and give them to a musician or singer to read. Ask them if they can read the notes easily and unambiguously (of course, to do this you'd also need to add a clef).

More info: http://en.wikipedia.org/wiki/Staff_(music)

0
4

Well, if you don't have any musical background, you should read about it. It's more complicated then it looks. Search for lilypond, or go for "musical notation" in wikipedia.

http://en.wikipedia.org/wiki/Musical_notation

By the way, your result is wrong.

4
  • I've been reading about it but cannot find anything simple enough for the scope of this project. Do notes always start from the very left on the staff, or do they have a fixed position on the 'x axis'?
    – 123
    Commented Dec 13, 2011 at 15:09
  • 1
    @Sean, well, that's important info. You're reading on the wrong places. Google something like "how to read music". The position and symbols that complement a note depends on which clef and which key signature you chose.
    – Victor
    Commented Dec 13, 2011 at 15:13
  • 7
    agreed; if you don't have time to understand the problem domain, you don't have time to code it.
    – slim
    Commented Dec 13, 2011 at 15:23
  • 3
    @Sean music notation is not a simple thing. Compare it to learning a new language; there isn't going to be a simple 5 step tutorial for you. My suggestion is to immerse yourself in musical scores until you can see all the intricacies of the notation. Commented Dec 13, 2011 at 17:21
0

Hire a piano teacher and take a short introductory piano course. You will understand lots more about notation after that, and you may get useful hints by discussing your software with the teacher.

Maybe you would be a strange student, so tell the teacher in advance about your goals.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.