/* * Created on Dec 26, 2005 * */ package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.score.*; import com.softsynth.jmsl.score.transforms.LyricLevelTransform; /** * Generate an eighth tone scale with flats preferred, to verify quarter tone accidental usage. * * Use JSyn instruments to hear this properly. MIDI will not do it for you. * * @author Nick Didkovsky, nick@didkovsky.com * */ public class QuarterTonesTest2 { public static void main(String[] args) { NoteFactory.useQuarterToneAccidentals(true); Score score = new Score(2, 1600, 2600); score.addMeasure(1, 4); double pitchIncrement = 0.25; int numNotes = (int) (24 / pitchIncrement); for (int j = 0; j < 2; j++) { int accPref = j == 0 ? Note.ACC_PREFER_FLAT : Note.ACC_PREFER_SHARP; double basePitch = j == 0 ? 76 : 60; int direction = j == 0 ? -1 : 1; // generate eighth tone scale for (int i = 0; i < numNotes; i++) { double duration = 1; double pitch = basePitch + direction * i * pitchIncrement; double amplitude = pitchIncrement; double hold = duration * 0.8; Note n = score.addNote(duration, pitch, amplitude, hold); n.setText(pitch + ""); n.setAccPref(accPref); } score.rewind(); score.setCurrentStaffNumber(1); } score.selectAll(); new LyricLevelTransform().operate(score, score.getSelectionBuffer()); score.getSelectionBuffer().deselectAndClear(); final ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.pack(); scoreFrame.setVisible(true); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { scoreFrame.quit(); } }); } }