Package com.softsynth.jmsl.jsyn
Class TransposingSampleSustainingInstrument
java.lang.Object
com.softsynth.jmsl.InstrumentAdapter
com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrument
com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrumentWithLoops
com.softsynth.jmsl.jsyn.TransposingSampleSustainingInstrument
- All Implemented Interfaces:
Editable
,Instrument
,Namable
,OutputProvider
,Transposable
,AttributeBuildable
,DirectorySettable
,HandleSpecialXMLTag
public class TransposingSampleSustainingInstrument extends SimpleSamplePlayingInstrumentWithLoops
Deprecated.
use the pure Java JSyn2 package instead
A JMSL Instrument that loads a sequence of monophonic SynthSamples. If there are gaps in the
chromatic scale, a sample will be stretched up or down from the closest sample.
While we recommend no more than a minor third between your samples for "believable" transposition, this is no longer enforced as of JMSL v103. Also new to v103, pitches may be fractional.
Each sample must have exactly two cue points: loop start and release start (where release start == loop end).
Difference from TransposingSamplePlayingInstrument: Uses two sampleReaders to crossfade loops to achieve smooth sustain. Your loop points don't have to start/end on zeroes, as the crossfade should kill pops. Default crossfade time is 50ms
IMPORTANT: Loop portion must be greater than 2 x crossfade duration!!! Do not use this ins with samples with very short sustain loops. Use TransposingSamplePlayingInstrument instead for samples with very short loops, or increase lengh of loop (for ex. the trumpet.aiff sample which ships with JSyn's Wire has a loop region which is too short to use with TransposingSampleSustainingInstrument but sounds fine with TransposingSamplePlayingInstrument).
Transposes up or down to reach those pitches which do not have samples mapped to them. Pitches may be fractional. Uses instrument's Tuning to transpose (new to build 5/8/05).
IMPORTANT: For Applets, the root sample directory passed to the constructor is ignored and CODEBASE is used instead!!!! So your samples should be in your applet's CODEBASE. The use of subfolders is ok, just make everything relative to CODEBASE. So for example, if locally you have a root sample directory called F:/JMSLScoreWork/JMSLScoreSamples/ relative to which all your samples are located, and inside it is violin/C60.wav, then your applet's CODEBASE, which might be a folder called "classes", should contain violin/C60.wav
This version adds new feature of being able to map pitches to different samples based on performance data, by overriding getAlternativeSampleIndex().
New to build 20060408,this class supports new methods loadSample(SynthSample sample, int noteIndex) for dynamically created samples. Note that you MUST set your own cue points for your sample data (see below):
While we recommend no more than a minor third between your samples for "believable" transposition, this is no longer enforced as of JMSL v103. Also new to v103, pitches may be fractional.
Each sample must have exactly two cue points: loop start and release start (where release start == loop end).
Difference from TransposingSamplePlayingInstrument: Uses two sampleReaders to crossfade loops to achieve smooth sustain. Your loop points don't have to start/end on zeroes, as the crossfade should kill pops. Default crossfade time is 50ms
IMPORTANT: Loop portion must be greater than 2 x crossfade duration!!! Do not use this ins with samples with very short sustain loops. Use TransposingSamplePlayingInstrument instead for samples with very short loops, or increase lengh of loop (for ex. the trumpet.aiff sample which ships with JSyn's Wire has a loop region which is too short to use with TransposingSampleSustainingInstrument but sounds fine with TransposingSamplePlayingInstrument).
Transposes up or down to reach those pitches which do not have samples mapped to them. Pitches may be fractional. Uses instrument's Tuning to transpose (new to build 5/8/05).
IMPORTANT: For Applets, the root sample directory passed to the constructor is ignored and CODEBASE is used instead!!!! So your samples should be in your applet's CODEBASE. The use of subfolders is ok, just make everything relative to CODEBASE. So for example, if locally you have a root sample directory called F:/JMSLScoreWork/JMSLScoreSamples/ relative to which all your samples are located, and inside it is violin/C60.wav, then your applet's CODEBASE, which might be a folder called "classes", should contain violin/C60.wav
This version adds new feature of being able to map pitches to different samples based on performance data, by overriding getAlternativeSampleIndex().
New to build 20060408,this class supports new methods loadSample(SynthSample sample, int noteIndex) for dynamically created samples. Note that you MUST set your own cue points for your sample data (see below):
SynthSample sample = new SynthSample(sampleData.length); sample.write(sampleData); sample.cuePoints = new java.util.Vector(); sample.cuePoints.addElement(new CuePoint(10, 1)); sample.cuePoints.addElement(new CuePoint(14000, 2)); // must be longer than xfade window ins.addSamplePitch(sample, 60);
- Author:
- Nick Didkovsky, nick@didkovsky.com (C) 2001 Nick Didkovsky, all rights reserved.
- See Also:
jmsltestsuite.TransposingSampleSustainingInstrumentWithAmplitudeMap
,TransposingSamplePlayingInstrument
-
Field Summary
Fields inherited from class com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrument
POLYPHONY
-
Constructor Summary
Constructors Constructor Description TransposingSampleSustainingInstrument()
Deprecated.TransposingSampleSustainingInstrument(java.lang.String sampleDirectory)
Deprecated.constructor. -
Method Summary
Modifier and Type Method Description void
buildFromAttributes()
Deprecated.double
getCrossfadeDuration()
Deprecated.java.lang.Object
getOutput()
Deprecated.get this output (SynthOutput in the case of a JSyn Instrument, for examplejava.lang.Object
getOutput(int part)
Deprecated.same as getOutput(), only one outputstatic void
main(java.lang.String[] args)
Deprecated.double
play(double playTime, double timeStretch, double[] dar)
Deprecated.If there is a sample loaded at dar[1], bang it.void
setCrossfadeDuration(double crossfadeDuration)
Deprecated.Methods inherited from class com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrumentWithLoops
addSamplePitch, clear, getSampleLoopRegioner, getSampleLoopRegioners, loadSample
Methods inherited from class com.softsynth.jmsl.jsyn.SimpleSamplePlayingInstrument
addEditListener, addSamplePitch, addSamplePitch, close, edit, getAlternativeSampleIndex, getDirectory, getEditEnabled, getNumChannels, getNumOutputs, getPitches, getSampleFilename, getSynthSamples, getTuning, getVoices, handleSpecialTag, notifyEditListeners, off, on, open, reload, removeEditListener, setDirectory, setEditEnabled, setNumChannels, setTuning, testSampleDirectory, writeSpecialXMLTags
Methods inherited from class com.softsynth.jmsl.InstrumentAdapter
getDimensionNameSpace, getInterpreter, getMixerClassName, getMusicDevice, getName, getTransposition, noteOff, noteOn, noteOnFor, setDimensionNameSpace, setInterpreter, setMixerClassName, setMusicDevice, setName, setTransposition, toString, update
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
TransposingSampleSustainingInstrument
public TransposingSampleSustainingInstrument()Deprecated. -
TransposingSampleSustainingInstrument
public TransposingSampleSustainingInstrument(java.lang.String sampleDirectory)Deprecated.constructor. sample directory string must end in dir delimitter, ex "F:\samples\"
-
-
Method Details
-
getOutput
public java.lang.Object getOutput()Deprecated.Description copied from interface:OutputProvider
get this output (SynthOutput in the case of a JSyn Instrument, for example- Specified by:
getOutput
in interfaceOutputProvider
- Overrides:
getOutput
in classSimpleSamplePlayingInstrument
- Returns:
- null
-
getOutput
public java.lang.Object getOutput(int part)Deprecated.Description copied from class:SimpleSamplePlayingInstrument
same as getOutput(), only one output- Specified by:
getOutput
in interfaceOutputProvider
- Overrides:
getOutput
in classSimpleSamplePlayingInstrument
- Returns:
- null
-
play
public double play(double playTime, double timeStretch, double[] dar)Deprecated.Description copied from class:SimpleSamplePlayingInstrument
If there is a sample loaded at dar[1], bang it. No sustain, no transposition. Hold time is not used to terminate sample early.- Specified by:
play
in interfaceInstrument
- Overrides:
play
in classSimpleSamplePlayingInstrumentWithLoops
-
buildFromAttributes
public void buildFromAttributes()Deprecated.- Specified by:
buildFromAttributes
in interfaceAttributeBuildable
- Overrides:
buildFromAttributes
in classSimpleSamplePlayingInstrument
-
main
public static void main(java.lang.String[] args)Deprecated. -
getCrossfadeDuration
public double getCrossfadeDuration()Deprecated.- Returns:
- Returns the crossfadeDuration.
-
setCrossfadeDuration
public void setCrossfadeDuration(double crossfadeDuration)Deprecated.- Parameters:
crossfadeDuration
- The crossfadeDuration to set. Crossfade duration is used during the looping portion of the sample
-