Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java and musical notation

 
ali sookun
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11178
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All text is rendered by Fonts.
I think you will have to find a font which supports notations and use it for your purpose.
 
Mike Simmons
Ranch Hand
Posts: 3090
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok thank for your information...
i just wanted to know the different possibilities before investigating the problem.
 
Maneesh Godbole
Saloon Keeper
Posts: 11178
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11178
15
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ali,
Found this: http://www.softsynth.com/links/java_music.html
Google around and you will find more interesting links.
 
Lucas Franceschi
Ranch Hand
Posts: 106
Mac Mac OS X Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This one looks helpful: http://code.google.com/p/abc4j/
 
ali sookun
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1840
Eclipse IDE Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Lucas Franceschi
Ranch Hand
Posts: 106
Mac Mac OS X Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 106
Mac Mac OS X Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


good luck, friend!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic