Results 1 to 9 of 9

Thread: glyphs & fonts for music notation display

  1. #1
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    4

    glyphs & fonts for music notation display

    Hello,

    I am trying to make an OpenGL program that can display music notation. Here's an example of music notation to refresh your memory (courtesy of google images):

    Currently, I have successfully drawn the horizontal lines (staves) using OpenGL and gotten them to antialias. It probably doesn't sound like a lot, but I am an opengl beginner, and it took me a few hours to get set up.

    I now need to add glyphs of various sizes and shapes to draw the actual notation. The glyphs could be the notes themselves (ovals at a slight tilt), or the clefs, or the sharps and flats, or the time signature (4/4). Additionally, I need to use a custom serif font to add in the composer's name at the top, etc. as well as other italic markings in the score (eg the word "sim." on the 6th line from the top).

    What is the preferred way to do this sort of 2d drawing? I researched truetype fonts and OpenGL online, but it sounds like that might be impossible or very slow. There are many different glyphs used in music notation (a few hundred). Is a font a bad thing to use in an OpenGL program? As an alternative to a bitmap type font, I was considering drawing a complex glyph (like a trebel clef) with polygons. However, I read online that doing too many polygons could be really slow. What is the best method of drawing glyphs and fonts for my particular application?

    As a final note, I am looking for a combination of speed and a crisp, high resolution because I will be updating the screen during a live performance, and musical notation has many tiny graphic nuances that are significant to the performer.

    Any answers or advice you have are greatly appreciated.

    thank you.

  2. #2
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: glyphs & fonts for music notation display

    Wow. That is a fairly complex set of texture work. Where to start.
    Ultimately you are going to need to rely on some libraries or spend a lot of time writing your own custom "font" code.

    Have you checked on sourceforge or elsewhere that someone hasn't already done this work. I am sure they must have to some degree...

    If you can find a truetype font that already has the music notation in it I would suggest using that with one of the libraries that supports it. It's not that slow at all.
    You can then wrap that in your code which will construct various note formations for you.

    The alternative is to construct your own texture atlas with various note glyphs and parts of note glyphs and then write a class to construct the notes from that.. I would think that having component parts and then blending the notes and the bars joining them together with multiple draws would be the best approach.

    Good luck with it.. And do check out sourceforge. I am sure this is work that has been done before.

  3. #3
    Senior Member Regular Contributor
    Join Date
    Jun 2009
    Location
    FL , USA
    Posts
    192

    Re: glyphs & fonts for music notation display

    There is a font rendering library FTGL for OGL 3.0.Or you can rely on wgl functions of windows where there are numerous functions to control character features.

    or other solution is , if you want to do less work ., edit your music file images as shown by you , then draw this image using glDrawPixel(). I assume that you do not want online editing of your rendered music notation.


  4. #4
    Member Contributor
    Join Date
    Mar 2006
    Posts
    53

    Re: glyphs & fonts for music notation display

    Just quickly browsing the available notation packages on Linux I came across several apps that seemed to be related...

    Denemo
    Lillypond
    MuseScore
    RoseGarden4
    Rumor
    Nted
    MusicTeX

    Don't know what their Windows counterparts are, or if they exist. Hope it helps just the same.

  5. #5
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    4

    Re: glyphs & fonts for music notation display

    Thanks scratt,

    I scoured sourceforge, as well as google, for some musical notation software that uses opengl. I had looked before, but I wanted to look again after reading your reply.

    There are very few (none?) mature music notation programs. The free notation software that I found either used a) some sort of a post script library (eg Lilypond) to basically generate a post script file and display it to the user (no interactivity), or b) used a platform-specific graphics toolkit (all of the ABC notation editors, for example) to draw very primitive notation glyphs (a few use gtk). There is 1 project that I found which uses OpenGL to render music notation -- it's a university project called PWGL. The source is not available, but they have a few academic papers where they allude to OpenGL. In these papers, the only details this author supplies are: 1) they use "OpenGL Vector Graphics" and b) "picking" for interacting with the user (http://www.mitpressjournals.org/doi/...19?cookieSet=1). Therefore, at least in the music notation domain specifically, no one has really done this in OpenGL. I would love if someone proves me wrong, but I can't find much of anything online.

    I did some research, and the big music notation tools (finale, sibelius, etc.) use true type fonts.

    To be clear, when you are suggesting the use of a font, you mean an outline-based / vector font right? I don't think bitmap textures for the notation is going to work, because finale and sibelius for example support zooming in (up to 1600%), as well as printing the score on paper. Given that, wouldn't it be more wise go with vectors? I imagine that 300 or so glyphs in bitmap format at 1024x768px (size when fully zoomed in) would be quite large.

    Before I dive into this font loading, etc. -- is there an easy way to render my SVG notation glyphs in OpenGL as vectors? I'd like to see what it looks like before I deal with a font loading library.

    What do you think?

    i appreciate your time.

  6. #6
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    4

    Re: glyphs & fonts for music notation display

    Hi awhig,

    Thanks for the FTGL reference.

    I do want online editing of the rendered notation. My goal is to make the program generate legitimate music notation, not just display pre-made parts; if I understand what you're saying about music file images, then no I don't want a solution where I am simply opening pre-made images and showing them.

    thanks

  7. #7
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: glyphs & fonts for music notation display

    Well you could use glyphs, but you'd need to make them of a big enough size that your largest level of zoom would not look pixelated. I think you realize that already.

    For screen fonts with glyphs I sometimes have two or three font atlases in different sizes.

    But for your application I would suggest that vector fonts would be best.
    Luckily as you probably know true type supports that.
    It is a very good library and you'll be surprised how fast it is.
    FTGL is good.

    I remember the first time I integrated it into an SDL app it felt quite convoluted getting all the various libraries together. But actually it was pretty trivial, and the flexibility is certainly worth having.

    Your aims are pretty comprehensive, especially with the level of zoom you want to provide etc. so the choice is pretty much made for you.

    For redraw speed, if / once you start hitting those issues you can look at splitting your sheet music into tiles, or simply three strips per sheet, and only update what changes.. Shift the rest around as texture slabs, which could be rendered in FBOs and only updated when they change...

  8. #8
    Junior Member Newbie
    Join Date
    Jul 2009
    Posts
    4

    Re: glyphs & fonts for music notation display

    Scratt,

    Thanks for your reply. That pretty much answers my question.

    One last thing, is SDL something that you would recommend I learn for this project?

    thanks again

  9. #9
    Senior Member Frequent Contributor scratt's Avatar
    Join Date
    May 2008
    Location
    Thailand
    Posts
    555

    Re: glyphs & fonts for music notation display

    No worries..

    SDL.. It's cross platform which is good. It is a media layer, but I tend to associate it with games rather than serious desktop apps. I'll probably get shot for saying that.

    Without knowing more about what you want to do I wouldn't like to say one way or the other, but anything that has a nice GUI system (which I think SDL has as add-ons) might be a nice way to go.. It certainly plays well with Freetype / Truetype etc.

    Others might have better suggestions for you on that.

Similar Threads

  1. Display Fonts/ Texts Opengl
    By ducle91 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-13-2013, 09:35 AM
  2. GLUI_Spinner Scientific Notation troubles
    By boo0g in forum OpenGL: General
    Replies: 0
    Last Post: 06-28-2011, 04:52 PM
  3. Using OpenGL to display Fonts on a Mac
    By erik.price in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-29-2008, 08:43 AM
  4. 2D fonts using Ortho - text doesn't display
    By chiser98 in forum OpenGL: User Software
    Replies: 1
    Last Post: 03-13-2008, 08:49 PM
  5. Fonts in OpenGL without display lists?
    By abhi_vg in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 02-12-2006, 09:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean