Class Ornament

java.lang.Object
eu.bandm.tscore.base.Entity<Ornament>
eu.bandm.music.entities.Ornament
All Implemented Interfaces:
Translet.Parseable<Ornament>, Cloneable
Direct Known Subclasses:
Ornament_JSB_klavierbuechlein, Ornament_KdF_special

public class Ornament extends Entity<Ornament> implements Cloneable
Abstract class for ornaments = shortcuts which replace one notated note with a certain sequence of played faster notes.

Instances of this very simple model basically are extended to sequences of fast played notes with pitches around the notated reference pitch. Only conceptually, all fast notes have the same duration which is an integral part of the notated duration of the reference note. The played pitches are n scalar steps remote from the reference, which is declared by the integers in the three sequences/arrays. The expansion works as follows:

  1. Determine the duration of the played notes.
  2. Determine how often the central segment must be repeated to fill the duration.
      All repeated indexes are melt into one single played event, so a central segment defined by "<0>", which is repeated as long as necessary, simply is a long hold of the reference pitch.
  • Field Details

    • pre

      public final int[] pre
      Sequence of pitch distances for the pre part of the ornament
    • rep

      public final int[] rep
      Sequence of pitch distances for the main repeated part of the ornament
    • post

      public final int[] post
      Sequence of pitch distances for the post part of the ornament
    • mainNote

      public static final int[] mainNote
      Can be used as the main part to simply hold the main note.
    • nothing

      public static final int[] nothing
      Can be used to make pre or post part not executing.
  • Constructor Details

    • Ornament

      protected Ornament(EntityCatalog<Ornament> c, Map<String,String> map, int[] pre, int[] rep, int[] post)
      Only construtor.
      Parameters:
      c - the catalog is here a collection of ornaments
      map - the name of the ornament in different langugages
      pre - the sequence of integers describing the pre part
      rep - the sequence of integers describing the main part, which can be repeated
      post - the sequence of integers describing the post part
  • Method Details

    • dump

      public void dump(PrintStream ps)
      Description copied from class: Entity
      Debugging method to display this entity. Called by EntityCatalog.dump(PrintStream)
      Overrides:
      dump in class Entity<Ornament>
    • repetitionLimits

      public int[] repetitionLimits(Rational noteDuration, Rational minDuration, Rational maxDuration)
      Returns the minimal and maximal possible number of repetitions of the central "rep" segment.
      Parameters:
      noteDuration - the overall notated duration of the note carrying this ornament.
      minDuration - the minimal duration for each played note when executing this ornament.
      maxDuration - the maximal duration for each played note when executing this ornament.
      Returns:
      array with minimal and maximal repetition counts
    • expand

      @Opt public @Opt List<Integer> expand(Rational noteDuration, Rational minDuration, Rational maxDuration, @Opt @Opt List<Integer> factors)
      Returns an expansion of the ornament as a list of (scale related)offsets to the central note. (= the same encoding as in pre, etc.)

      This very simple algorithm prefers the fastest found solution. Other variants are sensible, which e.g. prefer the most complex or least complex metric structure. This algorithm will fail to find a solution (return null) in many cases. A variant which allows the prolongation of one note (e.g. the very last) would generate much more hits.

      Parameters:
      noteDuration - the overall notated duration of the note carrying this ornament.
      minDuration - the minimal duration for each played note when executing this ornament.
      maxDuration - the maximal duration for each played note when executing this ornament.
      factors - allowed division factors which may be applied to approximate the required repetition count. Eg. [9,5] allows triplets, triplets in triplets. and 5-plets, while [15,7] allows triplets and 5-plets, even nested, and 7-plets.
    • doExpand

      protected List<Integer> doExpand(int r)