friends,
i observe that some do not understand my question. actually it is very easy to create MIDI files using java. but to create "a good music", does, ofcourse need a good musical background too (like where to put a high C and bla-bla-bla) i would like to present a small simple file which can show you how easy it is to create a music note in java. the program is shown below.
import javax.sound.midi.*;
public class testMusic1
{
public static void main(
String args[])
{
testMusic1 mini = new testMusic1();
mini.play();
}
public void play()
{
try{
//GET THE CD PLAYER and SWITCH IT ON
Sequencer player = MidiSystem.getSequencer();
player.open();
//GET THE CD
Sequence seq = new Sequence(Sequence.PPQ, 4);
//CREATE A SINGLE TRACK IN THE CD
Track track = seq.createTrack();
//--------- creating the SONG ---------------------
/*
CREATE EACH MESSAGE AND MIDIEVENT
AND AS AND WHEN CREATED, ADD THEM TO TRACK
*/
ShortMessage a = new ShortMessage();
a.setMessage(144,1,44,100);
MidiEvent noteOn = new MidiEvent(a,1);
track.add(noteOn);
ShortMessage b = new ShortMessage();
b.setMessage(128,1,44,25);
MidiEvent noteOff = new MidiEvent(b,10);
track.add(noteOff);
//--------- end of the SONG -----------------------
//NOW CD HAS THE SONG. PUT THE CD IN THE CD PLAYER
player.setSequence(seq);
//PUSH THE PLAY BUTTON OF THE PLAYER
player.start();
}
catch(Exception ex){
ex.printStackTrace();
}
}
}
note: just change the 3rd argument of setMessage function and music at different "pitch" will be played.
i have compared creating the music in java, with playing a CD in CD player (the typical kathy's style of explanation). the parameters of the following lines will say "how" and "when" the note should be played.
ShortMessage a = new ShortMessage();
a.setMessage(144,1,44,100);
MidiEvent noteOn = new MidiEvent(a,1);
track.add(noteOn);
the above 4 lines are for a "note on" (musicians can understand it, better?!) i know where to put the arguments to create music but do not know, how to compose notes and put the corresponding parameters to get some music I WANT. i need to be a musician for that.
INSTEAD

, i thought of getting some actual "ready made arguments" (that is numbers to put as arguments) from some source (and definitely not a actual sheet music of 4-lines-pages, that an actual musician will use) and put it as my arguments and play it so that my program can replay atleast some MUSIC rather than playing some junk notes, i put!
this is where, exactly i need your help friends! please suggest some sites which can help me create a MUSIC using java.
yours sincerely
R.Parthiban