Package com.softsynth.jmsl.jsyn
Class SynthNoteAllPortsInstrument
java.lang.Object
com.softsynth.jmsl.InstrumentAdapter
com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
com.softsynth.jmsl.jsyn.TunedSynthNoteInstrument
com.softsynth.jmsl.jsyn.JSynInsFromClassName
com.softsynth.jmsl.jsyn.SynthNoteAllPortsInstrument
- All Implemented Interfaces:
Instrument
,Namable
,OutputProvider
,Transposable
,UpdatableInstrument
,AttributeBuildable
,Tunable
- Direct Known Subclasses:
SynthNoteAllPortsInstrumentSP
public class SynthNoteAllPortsInstrument extends JSynInsFromClassName
Deprecated.
use the pure Java JSyn2 package instead
Create an Instrument by passing in the classname of a SynthNote. Sniffs out ports of SynthNote
and creates a SynthNoteDimensionNameSpace, mapping dimension numbers to SynthInput port names. If
the double[] passed to play() has dimensions for these extended ports, play() will look up the
name from DimensionNameSpace, pull the value from the array, and set the input port of the
SynthNote having the same name with that value.
on(), off(), and update() are implemented here, giving the user a finer grain of control over the
instrument, so you can for example call ins.on() then call update numerous times (with a MusicJob
for example), then finally call off().
- Author:
- Nick Didkovsky 4/22/02
-
Field Summary
Fields inherited from class com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
insNum
-
Constructor Summary
Constructors Constructor Description SynthNoteAllPortsInstrument()
Deprecated.SynthNoteAllPortsInstrument(int maxVoices, java.lang.String className)
Deprecated.SynthNoteAllPortsInstrument(int maxVoices, java.lang.String className, com.softsynth.jsyn.SynthContext synthContext)
Deprecated. -
Method Summary
Modifier and Type Method Description void
buildDimensionNameSpace()
Deprecated.void
buildFromAttributes()
Deprecated.static void
main(java.lang.String[] args)
Deprecated.Build and Play a MusicShape that bangs all the ports available in a com.softsynth.jsyn.circuits.FilteredSawtoothBL SynthNote.java.lang.Object
on(double playTime, double timeStretch, double[] dar)
Deprecated.on() method provides custom interpretation of double[].java.lang.String
toString()
Deprecated.double
update(double playTime, double timeStretch, double[] dar)
Deprecated.update amplitude and all input ports associated with dimensions >= 4.Methods inherited from class com.softsynth.jmsl.jsyn.JSynInsFromClassName
getSynthContext, getSynthNoteClassName, setSynthContext, setSynthNoteClassName
Methods inherited from class com.softsynth.jmsl.jsyn.TunedSynthNoteInstrument
getTuning, setTuning
Methods inherited from class com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
close, getAllocator, getMaxVoices, getName, getNumOutputs, getOutput, getOutput, getPolyphonic, getUpdateDimension, off, off, open, play, setAllocator, setMaxVoices, setName, setSynthNote, setUpdateDimension
Methods inherited from class com.softsynth.jmsl.InstrumentAdapter
getDimensionNameSpace, getInterpreter, getMixerClassName, getMusicDevice, getTransposition, noteOff, noteOn, noteOnFor, setDimensionNameSpace, setInterpreter, setMixerClassName, setMusicDevice, setTransposition
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
SynthNoteAllPortsInstrument
public SynthNoteAllPortsInstrument()Deprecated. -
SynthNoteAllPortsInstrument
public SynthNoteAllPortsInstrument(int maxVoices, java.lang.String className)Deprecated. -
SynthNoteAllPortsInstrument
public SynthNoteAllPortsInstrument(int maxVoices, java.lang.String className, com.softsynth.jsyn.SynthContext synthContext)Deprecated.
-
-
Method Details
-
toString
public java.lang.String toString()Deprecated.- Overrides:
toString
in classJSynInsFromClassName
-
buildFromAttributes
public void buildFromAttributes()Deprecated.- Specified by:
buildFromAttributes
in interfaceAttributeBuildable
- Overrides:
buildFromAttributes
in classJSynInsFromClassName
-
buildDimensionNameSpace
public void buildDimensionNameSpace()Deprecated. -
on
public java.lang.Object on(double playTime, double timeStretch, double[] dar)Deprecated.on() method provides custom interpretation of double[].double dur = dar[0];double pitch = dar[1]; double amplitude = dar[2]; // 0..1 double hold = dar[3]; // remainder of DimensionNameSpace
- Specified by:
on
in interfaceInstrument
- Overrides:
on
in classTunedSynthNoteInstrument
- Returns:
- allocated Synthnote. play() refers to this returned object directly and calls synthNoteOff()
- See Also:
Instrument.on(double, double, double[])
-
update
public double update(double playTime, double timeStretch, double[] dar)Deprecated.update amplitude and all input ports associated with dimensions >= 4.- Specified by:
update
in interfaceInstrument
- Overrides:
update
in classTunedSynthNoteInstrument
-
main
public static void main(java.lang.String[] args)Deprecated.Build and Play a MusicShape that bangs all the ports available in a com.softsynth.jsyn.circuits.FilteredSawtoothBL SynthNote. Essential code followspublic static void main(String args[]) { // Set up a frame that will close JMSL MusicDevices and System.exit() when closed JMSL.setViewFactory(new ViewFactorySwing()); PVFrame f = new PVFrameAdapter("Closebox to quit"); f.setFrameLayout(new java.awt.BorderLayout()); f.addWindowListener(new java.awt.event.WindowAdapter() { public void windowClosing(java.awt.event.WindowEvent e) { JMSL.closeMusicDevices(); System.exit(0); } }); f.setSize(300, 200); f.setVisible(true); JSynMusicDevice.instance().edit((Frame) f.getComponent()); JSynMusicDevice.instance().open(); JMSL.clock.setAdvance(0.1); JMSLRandom.randomize(); String synthNoteClassName = com.softsynth.jsyn.circuits.FilteredSawtoothBL.class.getName(); SynthNoteAllPortsInstrument ins = new SynthNoteAllPortsInstrument(); ins.setMaxVoices(8); ins.setSynthNoteClassName(synthNoteClassName); try { ins.buildFromAttributes(); JMSLMixerContainer mixer = new JMSLMixerContainer(); mixer.start(); mixer.addInstrument(ins); f.add(mixer.getPanAmpControlPanel()); f.pack(); MusicShape naiveMusicShape = new MusicShape(ins.getDimensionNameSpace()); naiveMusicShape.setInstrument(ins); for (int i = 0; i < 4; i++) { double[] data = new double[naiveMusicShape.dimension()]; data[0] = 2.0; // duration data[1] = JMSLRandom.choose(60.0, 65.0); // pitch data[2] = 0.1; // amp data[3] = 3.7; // sustain time // now randomize values for higher dimensions for (int d = 4; d < naiveMusicShape.dimension(); d++) { double lowLimit = naiveMusicShape.getLowLimit(d); double highLimit = naiveMusicShape.getHighLimit(d); double value = JMSLRandom.choose(lowLimit, highLimit); data[d] = value; } naiveMusicShape.add(data); } naiveMusicShape.setRepeats(1000); naiveMusicShape.addRepeatPlayable(new Playable() { public double play(double time, Composable parent) throws InterruptedException { MusicShape s = (MusicShape) parent; if (JMSLRandom.choose() < 0.25) { s.scramble(0, s.size() - 1, 1); } if (JMSLRandom.choose() < 0.25) { s.scramble(0, s.size() - 1, 4); } if (JMSLRandom.choose() < 0.25) { s.scramble(0, s.size() - 1, 5); } if (JMSLRandom.choose() < 0.25) { s.scramble(0, s.size() - 1, 6); } return time; } }); naiveMusicShape.launch(JMSL.now()); com.softsynth.jmsl.view.MusicShapeEditor se = new com.softsynth.jmsl.view.MusicShapeEditor(); se.addMusicShape(naiveMusicShape); f.add(java.awt.BorderLayout.SOUTH, se.getComponent()); f.pack(); } catch (Exception e2) { e2.printStackTrace(); } } *
-