org.jfugue.extras
Class DiatonicIntervalPatternTransformer

java.lang.Object
  extended by org.jfugue.PatternTransformer
      extended by org.jfugue.extras.DiatonicIntervalPatternTransformer
All Implemented Interfaces:
java.util.EventListener, ParserListener

public class DiatonicIntervalPatternTransformer
extends PatternTransformer

The DiatonicIntervalPatternTransformer transposes all notes in the given Pattern by a diatonic interval (1 -- unison, 2 -- second, ... 8 -- octave, etc.). It only handles upward motion and assumes the key of C. However, it could be used in conjunction with IntervalPatternTransformer to change to another key and/or perform downward motion.

For general information on how Pattern Transformers work, refer to the JFugue documentation.

Version:
2.0m
Author:
Bill Manaris (based on code by David Koelle)

Field Summary
static java.lang.String INTERVAL
          Pass this String to putVariable, along with the number of notes (Integer) by which you wish to raise the melody.
 
Fields inherited from class org.jfugue.PatternTransformer
returnPattern
 
Constructor Summary
DiatonicIntervalPatternTransformer()
          Instantiates a new DiatonicIntervalPatternTransformer object.
 
Method Summary
 java.lang.String getDescription()
          Indicates what this PatternTransformer does.
 java.lang.String getParameters()
          Returns a string declaring what variables DiatonicIntervalPatternTransformer can use to perform the transformation.
 void noteEvent(Note note)
          Transforms the given note
 void parallelNoteEvent(Note note)
          Transforms the given note
 void sequentialNoteEvent(Note note)
          Transforms the given note
 
Methods inherited from class org.jfugue.PatternTransformer
channelPressureEvent, controllerEvent, getParameter, instrumentEvent, keySignatureEvent, layerEvent, measureEvent, pitchBendEvent, polyphonicPressureEvent, putParameter, tempoEvent, timeEvent, transform, voiceEvent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INTERVAL

public static final java.lang.String INTERVAL
Pass this String to putVariable, along with the number of notes (Integer) by which you wish to raise the melody.

See Also:
Constant Field Values
Constructor Detail

DiatonicIntervalPatternTransformer

public DiatonicIntervalPatternTransformer()
Instantiates a new DiatonicIntervalPatternTransformer object. The default value of the diatonic interval is 1 (unison), which will result in no change to the given Music String.

Method Detail

getParameters

public java.lang.String getParameters()
Returns a string declaring what variables DiatonicIntervalPatternTransformer can use to perform the transformation.

DiatonicIntervalPatternTransformer requires the following:
'interval' - Integer - Number of diatonic intervals by which to change each note, can be only positive. Default is 1.

Overrides:
getParameters in class PatternTransformer

getDescription

public java.lang.String getDescription()
Description copied from class: PatternTransformer
Indicates what this PatternTransformer does.

Overrides:
getDescription in class PatternTransformer
Returns:
A String giving a quick description of this transformer

noteEvent

public void noteEvent(Note note)
Transforms the given note

Specified by:
noteEvent in interface ParserListener
Overrides:
noteEvent in class PatternTransformer
Parameters:
note - the event that has been parsed
See Also:
Note

sequentialNoteEvent

public void sequentialNoteEvent(Note note)
Transforms the given note

Specified by:
sequentialNoteEvent in interface ParserListener
Overrides:
sequentialNoteEvent in class PatternTransformer
Parameters:
note - the event that has been parsed
See Also:
Note

parallelNoteEvent

public void parallelNoteEvent(Note note)
Transforms the given note

Specified by:
parallelNoteEvent in interface ParserListener
Overrides:
parallelNoteEvent in class PatternTransformer
Parameters:
note - the event that has been parsed
See Also:
Note