|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.columbia.ee.csmit.MidiKaraoke.examples.LyricsRollExample
public class LyricsRollExample
Shows how to use the LyricsViewParser.
public static void main(String[] args) {
if(args.length == 0){
System.out.println("Usage: LyricsRollExample [midi file name]");
return;
}
try {
File file = new File(args[0]);
Sequence mySeq = MidiSystem.getSequence(file);
LyricsInMidi lyricsRoll = LyricsViewParser.parse(mySeq);
// get the track numbers with lyrics
int[] tracks = lyricsRoll.getTrackNumbers();
// Separate out the lyrics by track...
for(int i=0;i < tracks.length;i++){
System.out.format("****** Track %d:\n", tracks[i]);
LyricsInMidi.Line[] lines = lyricsRoll.getLines(tracks[i]);
for(int j=0;j < lines.length;j++){
// Print out the time in seconds and the line
System.out.format("%f: %s\n",lines[j].getSeconds(),
lines[j].getLine());
}
System.out.println("");
}
} catch (Exception e) {
System.out.println("Problem!");
e.printStackTrace();
System.out.println(e.toString());
}
}
| Constructor Summary | |
|---|---|
LyricsRollExample()
|
|
| Method Summary | |
|---|---|
static void |
main(java.lang.String[] args)
Shows how to use the LyricsViewParser to parse just the lyrics
in a Sequence. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public LyricsRollExample()
| Method Detail |
|---|
public static void main(java.lang.String[] args)
LyricsViewParser to parse just the lyrics
in a Sequence. Prints out the midi commands it reads.
args - the command line arguments. The first (and only) argument
should be the name of a midi file.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||