package jmsltutorial; import java.io.FileOutputStream; import java.io.PrintWriter; import com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrument; import com.softsynth.jmsl.util.SimpleXMLSaver; import com.softsynth.jsyn.Synth; /** A subclass of SimpleSamplePlayingInstrument which maps pitches to sound files. * * Copy and rename this example, change the buildFromAttributes() method. * * This Instrument was used by ND to compose Rama Broom, a homicidal fantasy for solo piano and voice for Kathleen Supove * * @author Nick Didkovsky, copyright 2000 Nick Didkovsky, all rights reserved * * */ public class SupoveVox extends SimpleSamplePlayingInstrument { static int insNum = 0; public SupoveVox() { super(); name = "SupoveVox_" + insNum++; } public SupoveVox(String sampleDirectory) { super(sampleDirectory); name = "SupoveVox_" + insNum++; } public void buildFromAttributes() { addSamplePitch("ram.wav", 60); addSamplePitch("a.wav", 62); addSamplePitch("broom.wav", 64); addSamplePitch("stick.wav", 65); addSamplePitch("four.wav", 67); addSamplePitch("hun.wav", 69); addSamplePitch("dred.wav", 71); addSamplePitch("times.wav", 72); addSamplePitch("up.wav", 74); super.buildFromAttributes(); } /** Create an instance of this class and write it out as an XML file */ public static void main(String args[]) { Synth.startEngine(0); SupoveVox ins = new SupoveVox("F:/jmslscorework/jmslscoresamples/supove/"); ins.buildFromAttributes(); try { PrintWriter out = new PrintWriter(new FileOutputStream("SupoveVox.xml")); (new SimpleXMLSaver(ins, "jmslscoreinstrument")).writeXML(out); out.close(); } catch (Exception e) { System.out.println("ERROR in main: " + e); } } }