public static void makethefile(String infile, String outfile, int rootnote, String temperamentstring, double maxpitchbend, Boolean writemaxpitchbend, int selectProgram, int tuningroot, double tuningfrequency, int transposeamt, Boolean overwrite)  throws MidiUnavailableException, InvalidMidiDataException, IOException {

	// open up the input midi file
        Sequence midiIn = null;
        try {
            midiIn = MidiSystem.getSequence(new File(infile));
        } catch (Exception e) {
            displayerror("Error opening midi file "+infile+" for reading");
	    return;
        }


	// make a new midi sequence to store the modified midi stream
	Sequence newMidi = RetuneMIDI.retunedSequence(midiIn,rootnote,temperamentstring,maxpitchbend,writemaxpitchbend,selectProgram,false,tuningroot,tuningfrequency, transposeamt,0);
	if(newMidi == null){
	    displayerror("Error generating new midi sequence");
	    return;
	}


	// Now write the new midi file
	try{
	    File f = new File(outfile);
	    if(!overwrite){
		if(f.exists() && !f.isDirectory()){
		    if(!getYesNo("File "+outfile+" exists.  Overwrite it?")){
			displayerror("No file written");
			return;
		    }
		}
	    }
	    MidiSystem.write(newMidi,1,f);
	} catch (IOException e) {
	    displayerror("Problem writing to file "+outfile);
	    return;
	}
	displaymessage("Done!  New midi file written to "+outfile);
    }