File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Java and musical notation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Java and musical notation" Watch "Java and musical notation" New topic
Author

Java and musical notation

ali sookun
Greenhorn

Joined: Dec 26, 2008
Posts: 10
hi there,
i want to make an applet to display musical notations
my question is does java has a library which can display the musical notation
or should i fetch images of the notations and then display them?
thanks in advance
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10329
    
    8

All text is rendered by Fonts.
I think you will have to find a font which supports notations and use it for your purpose.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Mike Simmons
Ranch Hand

Joined: Mar 05, 2008
Posts: 3014
    
  10
Maneesh, you seem to be assuming that musical notation should be considered text. I don't think that's the case. How would you handle multiple notes played at the same time? Would there be glyphs for all combinations of these? I tried to find info on Unicode representations of music, and I couldn't even find any way to represent the pitch of a single note. Much less a chord. Yes, there representations of a quarter note or half note - but there's no way to indicate the pitch of that note. Which is of severely limited usefulness, I think. I believe Ali would be much better off trying to render musical notation as images, not just text.

Ali: no, I don't know of any standard library for this stuff. Maybe there is one, maybe not. But I'm pretty sure that text and Fonts are not going to be the answer. They might play a role in your answer, I suppose, but not much.
ali sookun
Greenhorn

Joined: Dec 26, 2008
Posts: 10
ok thank for your information...
i just wanted to know the different possibilities before investigating the problem.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10329
    
    8

Mike,
You are most probably right. I have no idea how one goes about "writing" music

When I saw the post I did a quick google and found this which made me believe it could be treated as just any other text. Looks like I was wrong!



Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10329
    
    8

Ali,
Found this: http://www.softsynth.com/links/java_music.html
Google around and you will find more interesting links.
Lucas Franceschi
Ranch Hand

Joined: Nov 10, 2008
Posts: 106

you know, writing music is really really hard,

I dont know if you really understand music theory, but if you dont, i suggest yuo to take a fast studying about music, before starting programmin about music..

or, if you want another music softwares to look at, I suggest you guitar pro, take the trial and kinda see how it works, just a tip, so that your program can be even better
=D


Lucas Franceschi
Software Developer for SGI Sistemas, lukas1596@gmail.com
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41800
    
  62
This one looks helpful: http://code.google.com/p/abc4j/


Ping & DNS - my free Android networking tools app
ali sookun
Greenhorn

Joined: Dec 26, 2008
Posts: 10
hi there,
yes writing music is hard...that's true...however i already have an applet which play the musical sound and display a keybnoard. all i need to do now is to represent the sound by musical notes on a script.
so i am investigating a way to get the sound generated(represented by a number) and display the corresponding notes..the problem arises when a key is pressed more than once...so the notes change.
a solution i thought about was to store all the possible combination of the notation in a database(in form of images) then retrieve them with respect to the note been pressed.

the problems :-
the num of combinations is very large
and how to keep track of a key been pressed repeatedly(again).

i'll keep digging around...any suggestions are most welcome...
Joel McNary
Bartender

Joined: Aug 20, 2001
Posts: 1817

I've done a fair bit with music and Java, but I've not (yet) attempted to print music (to the screen or a paper).

There are fonts out there to do this; the feta font is used by LilyPond to produce its music notation. I'm not sure how useful that is, because you would have to manually position glyphs.

As far as when someone presses a key more than once, check out how MIDI handles it -- there are NoteOn and NoteOff events generated. You could do the same. (Or, you could just produce a MIDI file, as Java does support MIDI through its javax.sound.midi package).

I did start looking at how to display music in Java, and I think that the abc4j project that Ulf referenced did do that. I haven't had the chance to look at that in more detail, but that is where I would start.


Piscis Babelis est parvus, flavus, et hiridicus, et est probabiliter insolitissima raritas in toto mundo.
Lucas Franceschi
Ranch Hand

Joined: Nov 10, 2008
Posts: 106

ali sookun wrote:all i need to do now is to represent the sound by musical notes on a script.

you mean that you want to construct the scores for the music?
if so, you already have a knowledege about music scores?
ali sookun wrote:
so i am investigating a way to get the sound generated(represented by a number) and display the corresponding notes..the problem arises when a key is pressed more than once...so the notes change.

actually, i think you got a worst problem than you think, the notes change if it is pressed for an determinated period of time, the notes representation change if your score will be 4/4 or something else.
ali sookun wrote:
a solution i thought about was to store all the possible combination of the notation in a database(in form of images) then retrieve them with respect to the note been pressed.
that would probably result on a ultra giant database, i think.

ali sookun wrote:
the problems :-
the num of combinations is very large

... yes it is.

so, i think if you want to do this from the very own beggining, you'll probably succeed, but you will end having your own API for music writing, when theres always others that can be found

i think your solution, will be to use some of these API that already exists, as Ulf Dittmer said, http://code.google.com/p/abc4j/ is probably your solution for that case.

i mean, that is if you dont want to write your own api
ali sookun
Greenhorn

Joined: Dec 26, 2008
Posts: 10
thanks lucas
yep i dont know lot about music..i just started with this application...
currently i am doing a bit of research on music that is how the notes are dsiplayed in some applications...
Lucas Franceschi
Ranch Hand

Joined: Nov 10, 2008
Posts: 106



good luck, friend!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Java and musical notation