/* * Created on Jan 3, 2006 * */ package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.didkovsky.portview.swing.ViewFactorySwing; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.JMSLRandom; import com.softsynth.jmsl.jsyn.JSynInsFromClassName; import com.softsynth.jmsl.jsyn.JSynMusicDevice; import com.softsynth.jmsl.score.*; import com.softsynth.jmsl.util.Oof; import com.softsynth.jsyn.circuits.FilteredSawtoothBL; /** * Generate a measure of 256th notes. Use 1/F for pitch * * @author Nick Didkovsky, didkovn@mail.rockefeller.edu * */ public class TwoHundredFiftySixthNotes { public static void main(String[] args) { JMSL.setViewFactory(new ViewFactorySwing()); Score score = new Score(1, 1600, 600); score.addMeasure(4, 4); score.getMeasure(0).getStaff(0).setSpaceAbove(300); JSynMusicDevice.instance().open(); Orchestra orch = new Orchestra(); orch.addInstrument(new JSynInsFromClassName(8, FilteredSawtoothBL.class.getName())); score.setOrchestra(orch); Oof oof = new Oof(7); oof.randomize(); for (int i = 0; i < 4*64; i++) { double duration = 4.0 / 256.0; double pitch = Math.max(1, oof.next()); double amplitude = JMSLRandom.choose(); double hold = duration * 0.8; Note n = score.addNote(duration, pitch, amplitude, hold); n.setBeamedOut(i % 64 != 63); } final ScoreFrame scoreFrame = new ScoreFrame(); scoreFrame.addScore(score); scoreFrame.pack(); scoreFrame.setVisible(true); scoreFrame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { scoreFrame.quit(); } }); } }