import jm.music.data.*;import jm.JMC;import jm.util.*;import jm.audio.Instrument;/** * An example which creates a known chorale played in various tuning systems * It exploits the ability to specify audio notes by frequency. * @author Andrew R. Brown */public final class Tuning_Systems implements JMC{    public static void main(String[] args){        new Tuning_Systems();    }    public Tuning_Systems() {                // Batok Mikrokosmos        int[] pitchSop = {G4,A4,B4,BF4,A5,AS5,B4,A4,BF4,AF4,G4,A4,B4,BF4,C5,CS5,            D5,CS5,B4,C5,BF4,C5,B4,A4,BF4,G4,D5,CS5,B4,C5,BF4,C5,B4,A4,BF4,G4,            REST,E4,A4,BF4,REST,E4,A4,B4,REST,E4,A4,C5,REST};        double[] rhythmSop = {Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,2.5,            Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,Q,            C,Q,Q,Q,C,Q,Q,Q,C,Q,Q,Q,2.5};        int[] pitchAlto = {G4,D4,CS4,D4,G4,D4,A3, REST, E4,DS4,CS4,REST,D4,CS4,                           B3, FS4,CS4,REST,FS4,CS4,REST,FS4,CS4,REST,F3};        double[] rhythmAlto = {DC,C,DC,C,DC,C,2.5,DC,C,DC,C,DC,C,DC,C,            Q,Q,DC,Q,Q,DC,Q,Q,DC,2.5};        // current mode        double[] modeRatios = MEAN;                //create a score        Score score = new Score("Chorale", 130);                //add the parts to the score        score.addPart(createPart(pitchSop, rhythmSop, 0, modeRatios));        score.addPart(createPart(pitchAlto, rhythmAlto, 1, modeRatios));        //save the score as an audio file        Instrument[] insts = new Instrument[4];        for (int i=0; i<4; i++) {            insts[i] = new SquareLPFInst(22050, 500);        }                Write.au(score, "TuningSystems.au", insts);    }    /*    *This method converts the pitch and rhythm data into notes    * and packs them into a part.    */    private Part createPart(int[] pitches, double[] rhythms, int instrument,                             double[] modeRatios) {        Part part = new Part("", instrument);        Phrase phrase = new Phrase();        // add notes        for (int i=0; i<pitches.length; i++) {            if (pitches[i] == REST ) {                int pitch = REST;                phrase.addNote(new Note(pitch, rhythms[i]));            } else {                int degree = pitches[i]%12; // assumes we're in C maj or A min                double pitch = FRQ[pitches[i] - degree] * modeRatios[degree];                phrase.addNote(new Note(pitch, rhythms[i]));            }        }        part.addPhrase(phrase);        return part;    }}	