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(); 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); } ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.setVisible(true); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { JMSL.closeMusicDevices(); System.exit(0); } }); } }