public static void setupmidi() {
	// This sets up the sequencer,
	// populates the list of instruments available
	// on the synthesizer, and does the initial
	// tuning of the synthesizer.
	// The synthesizer is set up when we create kbPanel
	// in createGUI().
	try{
	    // For now we'll just use the default
	    // sequencer.  I may change that in future updates
	    theSequencer = MidiSystem.getSequencer(true);
	    try{
		theSequencer.addMetaEventListener(new MetaEventListener(){
			public void meta(MetaMessage msg){
			    if (msg.getType() == metaEndTrack ){ 
				endSequence(true);
			    }
			    if(msg.getType() == metaCuePoint){
				byte[] bmsg = msg.getData();
				String smsg = new String(bmsg);
				if(smsg.startsWith("on:")){
				    int note = Integer.parseInt(smsg.substring(3));
				    kbPanel.setSeqNote(note,true);
				}
				if(smsg.startsWith("off:")){
				    int note = Integer.parseInt(smsg.substring(4));
				    kbPanel.setSeqNote(note,false);
				}
			    }
			    /*
			    // used to debug tempo issues
			    if(msg.getType() == metaTempoChange){
				byte[] thebytes = msg.getData();
				System.out.println("\n");
				RetuneMIDI.printTempoChange(thebytes);
			    }
			    if(msg.getType() == metaTimeSignature){
				byte[] thebytes = msg.getData();
				System.out.println("\n");
				RetuneMIDI.printTimeSignature(thebytes);
			    }
			    */
			    
			}
		    });
	    } catch (Exception ea){
		// meta event listener not working - not fatal, move on
		// but we won't get any dots on the keyboard
	    }
	    
	    theSequencer.open();
	    
	} catch (Exception e) {
	    displayerror("Dang! Couldn't get a sequencer!  "+e.toString());
	}

	// list available instruments on the synthesizer
	ArrayList<String> thePrograms = kbPanel.getPrograms();
	for( String program : thePrograms ){
	    jProgram.addItem(program);
	}
	// set the default instrument to use
	jProgram.setSelectedIndex(defaultprogram);       
	kbPanel.setProgram(defaultprogram);
	// set the pitch bends to tune the synthesizer
	changeLiveTuning();
    }