Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Draw a music staff in C#

Tags:

I am looking to draw a music staff on a .NET (C#) form. I am using Microsoft Visual C# 2010 Express. I was wondering if anyone knew of existing code or existing free .NET libraries that can help with that. I am looking at drawing both the treble and bass clef staff and adding one quarter note to some where in the staff. I am making a Piano Tester app using C# for my son. If I code it myself, I will proably just override the onPaint method. But I thought I would see if anyone has seen some free code or library available to get me started.

like image 556
JeffJak Avatar asked Oct 29 '10 14:10

JeffJak


People also ask

What is the C on a music staff?

Answer: You've probably seen a curious C symbol at the beginning of a your sheet music after the clef and key signature - this is simply another way of writing “common time,” a.k.a. the 4/4 time signature.

Where is the C in G-clef?

There are 3 types of clefs -- treble or G-clef, the bass or F-clef and the C-clefs. The curl of the treble clef circles the line that is G on the staff. The dots of bass clef are around the line that is F. The middle of C-clef is at the line that is middle C.


2 Answers

There are the required primitives to generate musical output in the Unicode code set (starting at U+1D100). For example, U+1D11A is a 5-line staff, U+1D158 is a closed notehead.

See http://www.unicode.org/charts/PDF/U1D100.pdf

..then the issue becomes making sure that you have a typeface with the appropriate glyphs included (and dealing with the issues of spacing things correctly, etc.)

IF you're looking to generate printed output, you should look at Lilypond, which is an OSS music notation package that uses a text file format to define the musical content and then generates gorgeous output.

like image 67
bgporter Avatar answered Oct 11 '22 09:10

bgporter


You might look at a music editing program written in C# a few years ago. I looks somewhat promising: Music Editing Program

like image 22
JeremyDWill Avatar answered Oct 11 '22 10:10

JeremyDWill