com.softsynth.jmsl.jsyn
Class SynthNoteAllPortsInstrumentSP
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
com.softsynth.jmsl.jsyn.SynthNoteAllPortsInstrumentSP
- All Implemented Interfaces:
- Instrument, Namable, OutputProvider, SignalProcessingInstrument, Transposable, AttributeBuildable
public class SynthNoteAllPortsInstrumentSP
- extends SynthNoteAllPortsInstrument
- implements SignalProcessingInstrument
SignalProcessing Instrument.
This Instrument behaves just like SynthNoteAllPortsInstrument except that it
implements JSynSignalProcessingInstrument which defines
addSignalSource(SynthOutput signalSource). So the output from another
SynthCircuit or from some JSynInstrument.getoutput() can be sent into it for
SignalProcessing. play() bangs all the input ports of the signal processor.
The class name passed into the constructor *must* be a JSyn SynthNote that,
beside amplitude and frequency ports, has a public input port named "input"
on() and off() are implemented here, giving the user a finer grain of control
over the instrument
Note that this instrument is polyphonic so you could stack effects with
different parameters (for example in JScore, a chord with one of these
instruments could have different delay times on each note)
- Author:
- Nick Didkovsky, (c) 2002 Nick Didkovsky
Method Summary |
void |
addSignalSource(java.lang.Object signalSource)
JSynSignalProcessingInstrument interface. |
void |
buildFromAttributes()
|
static void |
main(java.lang.String[] args)
Filter white noise with a signal processing synthnote instrument
public static void main(String args[]) {
java.awt.Frame f = new java.awt.Frame("Closebox to quit");
f.setLayout(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(f); JSynMusicDevice.instance().open();
JMSL.clock.setAdvance(0.5); JMSLRandom.randomize();
String synthNoteClassName =
com.softsynth.jmsl.jsyn.circuits.BandPassSynthNote.class.getName();
SynthNoteAllPortsInstrumentSP ins = new SynthNoteAllPortsInstrumentSP();
ins.setMaxVoices(1); ins.setSynthNoteClassName(synthNoteClassName); try {
ins.buildFromAttributes();
JMSLMixerContainer mixer = new JMSLMixerContainer(); mixer.start();
mixer.addInstrument(ins); f.add(java.awt.BorderLayout.NORTH,
mixer.getPanAmpControlPanel());
MusicShape naiveMusicShape = new MusicShape(5);
naiveMusicShape.setDimensionName(4, "Q"); // dimensions 0..3 will be
copied across to instrument's double[] as standard invariants // so just
need to define dimensions above 3 whose names match instrument ports for
(int i = 0; i < 17; i++) { double dur = JMSLRandom.choose(0.1, 0.4);
double pitch = JMSLRandom.choose(1, 128); double amp =
JMSLRandom.choose(0.2, 1.0); int indexOfQ =
ins.getDimensionNameSpace().getDimension("Q"); double q =
JMSLRandom.choose( ins.getDimensionNameSpace().getLowLimit(indexOfQ),
ins.getDimensionNameSpace().getHighLimit(indexOfQ));
naiveMusicShape.add(dur, pitch, amp, dur, q); }
naiveMusicShape.setInstrument(ins);
naiveMusicShape.setRepeats(1000); // Signal source WhiteNoise noise = new
WhiteNoise(); noise.start(); ins.addSignalSource(noise.output);
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(); } } |
void |
removeAllSignalSources()
JSynSignalProcessingInstrument interface. |
java.lang.String |
toString()
|
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 |
Methods inherited from interface com.softsynth.jmsl.Instrument |
close, getDimensionNameSpace, getInterpreter, getMixerClassName, getMusicDevice, off, on, open, play, setDimensionNameSpace, setInterpreter, setMixerClassName, setMusicDevice, update |
SynthNoteAllPortsInstrumentSP
public SynthNoteAllPortsInstrumentSP()
SynthNoteAllPortsInstrumentSP
public SynthNoteAllPortsInstrumentSP(int maxVoices,
java.lang.String className)
- The class name passed into the constructor *must* be a JSyn SynthNote
that, besides amplitude and frequency ports, has a public input port
named "input"
SynthNoteAllPortsInstrumentSP
public SynthNoteAllPortsInstrumentSP(int maxVoices,
java.lang.String className,
com.softsynth.jsyn.SynthContext synthContext)
toString
public java.lang.String toString()
- Overrides:
toString
in class SynthNoteAllPortsInstrument
buildFromAttributes
public void buildFromAttributes()
- Specified by:
buildFromAttributes
in interface AttributeBuildable
- Overrides:
buildFromAttributes
in class SynthNoteAllPortsInstrument
addSignalSource
public void addSignalSource(java.lang.Object signalSource)
- JSynSignalProcessingInstrument interface. Use this to bus another output
of some SynthNote or JSynInstrument to this Signal Processing Instrument
- Specified by:
addSignalSource
in interface SignalProcessingInstrument
removeAllSignalSources
public void removeAllSignalSources()
- JSynSignalProcessingInstrument interface.
- Specified by:
removeAllSignalSources
in interface SignalProcessingInstrument
main
public static void main(java.lang.String[] args)
- Filter white noise with a signal processing synthnote instrument
public static void main(String args[]) {
java.awt.Frame f = new java.awt.Frame("Closebox to quit");
f.setLayout(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(f); JSynMusicDevice.instance().open();
JMSL.clock.setAdvance(0.5); JMSLRandom.randomize();
String synthNoteClassName =
com.softsynth.jmsl.jsyn.circuits.BandPassSynthNote.class.getName();
SynthNoteAllPortsInstrumentSP ins = new SynthNoteAllPortsInstrumentSP();
ins.setMaxVoices(1); ins.setSynthNoteClassName(synthNoteClassName); try {
ins.buildFromAttributes();
JMSLMixerContainer mixer = new JMSLMixerContainer(); mixer.start();
mixer.addInstrument(ins); f.add(java.awt.BorderLayout.NORTH,
mixer.getPanAmpControlPanel());
MusicShape naiveMusicShape = new MusicShape(5);
naiveMusicShape.setDimensionName(4, "Q"); // dimensions 0..3 will be
copied across to instrument's double[] as standard invariants // so just
need to define dimensions above 3 whose names match instrument ports for
(int i = 0; i < 17; i++) { double dur = JMSLRandom.choose(0.1, 0.4);
double pitch = JMSLRandom.choose(1, 128); double amp =
JMSLRandom.choose(0.2, 1.0); int indexOfQ =
ins.getDimensionNameSpace().getDimension("Q"); double q =
JMSLRandom.choose( ins.getDimensionNameSpace().getLowLimit(indexOfQ),
ins.getDimensionNameSpace().getHighLimit(indexOfQ));
naiveMusicShape.add(dur, pitch, amp, dur, q); }
naiveMusicShape.setInstrument(ins);
naiveMusicShape.setRepeats(1000); // Signal source WhiteNoise noise = new
WhiteNoise(); noise.start(); ins.addSignalSource(noise.output);
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(); } }