/* * Created on Nov 1, 2008 * */ package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.softsynth.jmsl.score.*; /** * Generate a eighth tone scale with quarter tone accidentals. * Debug the 47.75, 35.75, 23.75 bug which displays these pitches one octave too low (thanks to Georg Hajdu 11/1/08) * * Use JSyn instruments to hear this properly. MIDI will not do it for you. * * @author Nick Didkovsky, nick@didkovsky.com * */ public class EighthTones { public static void main(String[] args) { // the use of quarter tone accidentals for pitches exactly 0.5 between whole numbers is true // by default. The use of quarter tone accidentals is set and unset using NoteFactory // method: NoteFactory.useQuarterToneAccidentals(false); Score score = new Score(2, 1500, 600); score.addMeasure(4, 4); double basePitch = 40; int numNotes = 12*8+1; // generate rising quarter tone scale with sharp spelling preferred // sharps preferred by default so we do not need to n.setAccPref(Note.ACC_PREFER_SHARP); for (int i = 0; i < numNotes; i++) { double duration = 0.5; if (i == numNotes - 1) duration = 4.0; double pitch = basePitch + i * 0.25; double amplitude = 0.5; double hold = duration * 0.8; Note n = score.addNote(duration, pitch, amplitude, hold); n.setBeamedOut(i % 2 == 0); } score.rewind(); // set current measure to 0 again for insertion of new notes score.setCurrentStaffNumber(1); // generate quarter tone scale with flat spelling preferred for (int i = 0; i < numNotes; i++) { double duration = 0.5; if (i == numNotes - 1) duration = 4.0; double pitch = basePitch + 12 - i * 0.5; double amplitude = 0.5; double hold = duration * 0.8; Note n = score.addNote(duration, pitch, amplitude, hold); n.setAccPref(Note.ACC_PREFER_FLAT); n.setBeamedOut(i % 2 == 0); } final ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.pack(); scoreFrame.setVisible(true); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { scoreFrame.quit(); } }); } }