package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.score.*; /** * This simply uses addNote(dur) to add notes to a Score. Use this if you know * what the duration values of your events are. * * It is *not* a test of the more sophisticated transcriber * * @author Nick Didkovsky and Phil Burk, copyright 2000 Nick Didkovsky and Phil * Burk */ public class AddNotesToScore { public static void main(String args[]) { int w = 1000; int h = 750; int numStaves = 1; Score score = new Score(numStaves, w, h, "Add Notes To a Score"); score.addMeasure(5, 8); double dur = 0.333/2; double pitch = 60; for (int i=0; i<6; i++) { Note n = score.addNote(dur , pitch, 0.5, dur * 0.8); n.addInterval(pitch+7); if (i < 5) { n.setBeamedOut(true); } } double[] durations = { .75, .25, .875, .125, .75, .25, .875, .125 }; for (int i = 0; i < durations.length; i++) { score.addNote(durations[i], NoteFactory.MIDDLE_C + i, 0.5, durations[i] * 0.8); } // score.addNote(0, NoteFactory.MIDDLE_C , 0.5, 0.8); ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.setVisible(true); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { JMSL.closeMusicDevices(); System.exit(0); } }); } }