package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.score.NoteFactory; import com.softsynth.jmsl.score.Score; import com.softsynth.jmsl.score.ScoreFrame; import com.softsynth.jmsl.util.EventDistributions; import com.softsynth.jmsl.util.ExponentialInterpolator; /** Torture Score's ability to match arbitrary duration.
* * This simply uses addNote(dur) * It is *not* a test of the more sophisticated transcriber * * Add notes with increasing Myhill ratio ... adds rhythmic jitter.
* Don't expect measures to have the correct total durations in them. addNote() just adds a note with * the closest duration to the one specified and if overflow, goes to next measure * * @author Nick Didkovsky and Phil Burk, copyright 2000 Nick Didkovsky and Phil Burk */ public class TestScoreDurations { public static void main(String args[]) { int w = 1000; int h = 750; int numStaffs = 1; int numNotes = 1000; Score score = new Score(numStaffs, w, h, "Test Insane Durations"); score.addMeasure(); ExponentialInterpolator interpolator = new ExponentialInterpolator(0, 1.00001, numNotes, 128); interpolator.setSteepness(8); for (int i = 0; i < numNotes; i++) { double ratio = interpolator.interp(i); double wackedOutDuration = EventDistributions.genEntryDelayMyhill(4.0, ratio); score.addNote(wackedOutDuration, NoteFactory.MIDDLE_C, 0.5, 0.25); } ScoreFrame f = new ScoreFrame(); f.addScore(score); f.setVisible(true); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } }