edu.columbia.ee.csmit.MidiKaraoke.examples
Class PianoRollExample

java.lang.Object
  extended by edu.columbia.ee.csmit.MidiKaraoke.examples.PianoRollExample

public class PianoRollExample
extends java.lang.Object

Shows how to get a PianoRoll from a midi file.

    public static void main(String[] args) {

        if(args.length == 0){
            System.out.println("Usage: PianoRollExample [midi file name]");
            return;
        }


        try {
            File file = new File(args[0]);
            Sequence mySeq = MidiSystem.getSequence(file);
            PianoRoll roll = PianoRollViewParser.parse(mySeq);
            NotesInMidi[] notes = roll.getNotes();
            for(int i=1;i < notes.length;i++){
                System.out.println(notes[i].toString());
            }
        } catch (Exception e) {
            System.out.println("Problem!");
            e.printStackTrace();
            System.out.println(e.toString());
        }

    }

 


Constructor Summary
PianoRollExample()
           
 
Method Summary
static void main(java.lang.String[] args)
          Shows how to use the PianoRollViewParser to parse midi commands in a PianoRoll.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PianoRollExample

public PianoRollExample()
Method Detail

main

public static void main(java.lang.String[] args)
Shows how to use the PianoRollViewParser to parse midi commands in a PianoRoll. Prints out the notes it read.

Parameters:
args - the command line arguments. The first (and only) argument should be the name of a midi file.