/* * Created on Oct 8, 2003 * */ package jmsltestsuite; import com.softsynth.jmsl.JMSL; import com.softsynth.jmsl.JMSLMixerContainer; import com.softsynth.jmsl.MusicShape; import com.softsynth.jmsl.jsyn.TransposingSamplePlayingInstrument; /** * Load samples into a TransposingSamplePlayingInstrument, assigned to pitches. This instrument will * transpose up or down to fill in the gaps. * * @author Nick Didkovsky, email: didkovn@mail.rockefeller.edu, (c) 2003 Nick Didkovsky, all rights reserved. * */ public class TestSamplePlaying { public static void main(String args[]) { java.awt.Frame f = new java.awt.Frame("Test TransposingSamplePlayingInstrument"); f.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { JMSL.closeMusicDevices(); System.exit(0); } }); // CHANGE THE TOP LEVEL SAMPLE DIRECTORY BELOW TransposingSamplePlayingInstrument ins = new TransposingSamplePlayingInstrument("F:/JMSLScoreWork/JMSLScoreSamples/"); ins.getMusicDevice().edit(f); ins.getMusicDevice().open(); // Assign samples to pitches. The instrument will transpose up or down to fill in gaps // THESE PATHS ARE RELATIVE TO TOP LEVEL SAMPLE DIR ins.addSamplePitch("mums/violin_bowed/g3.wav", 56); ins.addSamplePitch("mums/violin_bowed/as3.wav", 59); ins.buildFromAttributes(); JMSLMixerContainer mixer = new JMSLMixerContainer(); mixer.addInstrument(ins); mixer.start(); f.add(mixer.getPanAmpControlPanel()); f.pack(); f.setVisible(true); // PrintWriter pout = new PrintWriter(new FileOutputStream("tsp.xml")); // (new com.softsynth.jmsl.util.SimpleXMLSaver(ins, "jmslscoreinstrument")).writeXML(pout); // pout.close(); JMSL.clock.setAdvance(0.5); MusicShape s = new MusicShape(4); s.add(4.00, 59, 0.5, 3.4); s.add(4.00, 58.5, 0.5, 3.4); // 1/4 tone pitch s.add(1.00, 58, 0.4, 0.25); s.add(1.00, 57, 0.3, 0.5); s.add(1.00, 56, 0.5, 0.75); s.setInstrument(ins); s.setRepeats(1000); s.launch(JMSL.now()); } }