package jmsltestsuite; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import com.didkovsky.portview.PVFrame; import com.softsynth.jmsl.util.ExponentialInterpolator; import com.softsynth.jmsl.view.MusicShapeEditor; import com.softsynth.jmsl.view.PVFrameAdapter; public class ExpInterpTest { /** Build an exponentially rising shape and display in Shape Editor. Each dimension d reflects a steepness value of (d+1) */ public static void main(String args[]) { ExponentialInterpolator exp = new ExponentialInterpolator(0.0, 1.0, 600.0, 100.0); com.softsynth.jmsl.MusicShape s = new com.softsynth.jmsl.MusicShape(20); s.setLimits(0, 0, 200); // first fill with blank data for (int i = 0; i < 600; i++) { double dar[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; s.add(dar); } // now load the shape up with real data, increasing the steepness for each dimension for (int dim = 0; dim < 20; dim++) { exp.setSteepness(dim + 1.0); System.out.println(dim + ""); for (int el = 0; el < 600; el++) { s.set(exp.interp((double) el), el, dim); } } MusicShapeEditor se = new MusicShapeEditor(); se.addMusicShape(s); PVFrame f = new PVFrameAdapter("Close to Exit"); f.add(se.getComponent()); f.pack(); f.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); f.setVisible(true); System.out.println("Each dimension d reflects a steepness value of (d+1), ie dim_4 has a steepness of 5"); } }