com.softsynth.jmsl.jsyn
Class TunedSynthNoteInstrument

java.lang.Object
  extended by com.softsynth.jmsl.InstrumentAdapter
      extended by com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
          extended by com.softsynth.jmsl.jsyn.TunedSynthNoteInstrument
All Implemented Interfaces:
Instrument, Namable, OutputProvider, Transposable
Direct Known Subclasses:
Brass, JSynInsFromClassName, RingMod, SuperBrass, SuperNoiseSwoop, SuperRingModBell

public class TunedSynthNoteInstrument
extends FreqSynthNoteInstrument

A JMSL Instrument that plays a JSyn SynthNote.
Only difference between this and superclass FreqSynthNoteInstrument is that dimension 1 of this is pitch, not frequency Optional constructor passes in a BussedVoiceAllocator to make this polyphonic.
double[] passed to play must contain duration, pitch, amplitude, hold
duration and hold (sustain) is in seconds. pitch can be fractional (ie 60.5 is a qtr tone higher than middle c), amplitude is 0..1 Tuning provides frequency from pitchIndex. update() can be used to change the amplitde of a sustain synthnote. on() and off() are implemented here, giving the user a finer grain of control over the instrument

Author:
Nick Didkovsky, Nick.Didkovsky@mail.rockefeller.edu (C) 2000 Nick Didkovsky, all rights reserved.

Field Summary
 
Fields inherited from class com.softsynth.jmsl.jsyn.FreqSynthNoteInstrument
insNum
 
Constructor Summary
TunedSynthNoteInstrument()
          Constructor sets MusicDevice to JSynMusicDevice
TunedSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator)
          polyphonic constructor
TunedSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator, Tuning tuning)
          polyphonic constructor
TunedSynthNoteInstrument(com.softsynth.jsyn.SynthNote synthNote, Tuning tuning)
          monophonic constructor
 
Method Summary
 Tuning getTuning()
           
static void main(java.lang.String[] args)
          Create a polyphonic, stereo instrument, and play a MusicShape with it.
 java.lang.Object on(double playTime, double timeStretch, double[] dar)
          Allocate a SynthNote and call SynthNote.noteOn()
 void setTuning(Tuning t)
          defaults to 12TET but you change that here
 double update(double playTime, double timeStretch, double[] dar)
          Update amplitude and frequency using (by default) dimension 1 as lookup to retrieve allocated synthnote.
 
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, toString
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TunedSynthNoteInstrument

public TunedSynthNoteInstrument()
Constructor sets MusicDevice to JSynMusicDevice


TunedSynthNoteInstrument

public TunedSynthNoteInstrument(com.softsynth.jsyn.SynthNote synthNote,
                                Tuning tuning)
                         throws com.softsynth.jsyn.SynthException
monophonic constructor

Throws:
com.softsynth.jsyn.SynthException

TunedSynthNoteInstrument

public TunedSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator,
                                Tuning tuning)
                         throws com.softsynth.jsyn.SynthException
polyphonic constructor

Throws:
com.softsynth.jsyn.SynthException

TunedSynthNoteInstrument

public TunedSynthNoteInstrument(BussedVoiceAllocatorMultiOut allocator)
                         throws com.softsynth.jsyn.SynthException
polyphonic constructor

Throws:
com.softsynth.jsyn.SynthException
Method Detail

setTuning

public void setTuning(Tuning t)
defaults to 12TET but you change that here


getTuning

public Tuning getTuning()

on

public java.lang.Object on(double playTime,
                           double timeStretch,
                           double[] dar)
Allocate a SynthNote and call SynthNote.noteOn()
 double pitch = dar[1];
 double amp = dar[2];  //  0..1
 

Specified by:
on in interface Instrument
Overrides:
on in class FreqSynthNoteInstrument
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)
Update amplitude and frequency using (by default) dimension 1 as lookup to retrieve allocated synthnote. You may change this with setUpdateDimension()

Specified by:
update in interface Instrument
Overrides:
update in class FreqSynthNoteInstrument

main

public static void main(java.lang.String[] args)
Create a polyphonic, stereo instrument, and play a MusicShape with it. Uses 13tet tuning with fractional pitches