Class Fields

java.lang.Object
eu.bandm.music.comp.Fields

public class Fields extends Object
Create the list of all possible "twelve tone fields" which use only a particular set of intervals, and each of these intervals appears at least once. A "twelve tone field" is a mapping from the twelve enharmonic pitch classes of "twelve tone theory" to octave registers.

Usage is like

   f = new Fields().allow(1).allow(5).resolve();
   
  

This provisorical implementation writes the found solutions in number form to stdout and as a musicXml score to a disk file.

Pitch classes and intervals are both represented symbollically by the numbers 0..11; pitches are represented by non-negative integers.

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected class 
    Each Item represents one construction step of a field.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final SortedSet<Integer>
    The set of allowed intervals.
    protected final List<Fields.Item>
    All found fields after executing resolve().
    protected Fields.Item
    The start element of the fields' tree, representing a field with just one pitch =0.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    (package private) Fields
    allow(int i)
    Add a further interval to the set of allowed intervals.
    int[]
    Return a given field as an item of integers which represent the pitch classes.
    eu.bandm.music.small_musicXml.Element_score_partwise
    Convert all solutions as stored in results as an XML score block, and combine these into one single score Element_score_partwise.
    protected void
    asMusicXML(Fields.Item item, int number, List<eu.bandm.music.small_musicXml.Element_part> music_results, List<eu.bandm.music.small_musicXml.Element_score_part> index_results)
    Encode one field as an ascending sequence of note heads in music XML.
    Convert one field into a sequence of pitches.
    void
    Print all results found to "ps".
    void
    Print the pitch classes of all its predecessors, followed by that of "i".
    static void
    main(String[] s)
    Test application, allowed intervals must be added in the source text, result is always written into "TESTOUT.xml"
    void
    If the Item / field represented by the itme has already 12 / all pitch classes, then store it in results.
    void
    Central service provider: Create a root note and prolongate it with 11 successors to complete fields.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • allowedIntervals

      protected final SortedSet<Integer> allowedIntervals
      The set of allowed intervals. Set incrementally by allow(int) after constructing this instance.
    • results

      protected final List<Fields.Item> results
      All found fields after executing resolve().
    • root

      protected Fields.Item root
      The start element of the fields' tree, representing a field with just one pitch =0.
  • Constructor Details

    • Fields

      public Fields()
  • Method Details

    • allow

      Fields allow(int i)
      Add a further interval to the set of allowed intervals.
    • resolve

      public void resolve()
      Central service provider: Create a root note and prolongate it with 11 successors to complete fields.
    • prolongate

      public void prolongate(Fields.Item start)
      If the Item / field represented by the itme has already 12 / all pitch classes, then store it in results. Otherwise test each of the allowed intervals: Its adding to the top of "start" must deliver in a pitch class not yet present in "start". If so, create a new Item and call prolongate(Item) recursively.
    • dump

      public void dump(PrintStream ps)
      Print all results found to "ps".
    • dump

      public void dump(PrintStream ps, @Opt @Opt Fields.Item i)
      Print the pitch classes of all its predecessors, followed by that of "i".
    • asPitches

      Convert one field into a sequence of pitches. This is normally applied to fields contained in results.
      Parameters:
      item - represents the field
      repr - TwelveToneFunctionalRepresentation maps twelve tone pitch classes into functional pitch classes, just to make them notatable in CWN. Assume that both the fields and the TwelveToneFunctionalRepresentation start with the index ==0.
    • asArray

      public int[] asArray(Fields.Item item)
      Return a given field as an item of integers which represent the pitch classes.
    • asMusicXML

      public eu.bandm.music.small_musicXml.Element_score_partwise asMusicXML()
      Convert all solutions as stored in results as an XML score block, and combine these into one single score Element_score_partwise. Therein each field/solution is contained in one dedicated staff/instrument/"part".
    • asMusicXML

      protected void asMusicXML(Fields.Item item, int number, List<eu.bandm.music.small_musicXml.Element_part> music_results, List<eu.bandm.music.small_musicXml.Element_score_part> index_results)
      Encode one field as an ascending sequence of note heads in music XML.
      Parameters:
      item - the field to print
      number - the number which appears in the name of the "part"/voice/staff
      music_results - where to append the "Element_measure" which contains the notes
      index_results - where to index entry to this new staff
    • main

      public static void main(String[] s)
      Test application, allowed intervals must be added in the source text, result is always written into "TESTOUT.xml"

      FIXME umbauen auf cmd line paraemter "8te" ==> "fields_8te.xml" "fields_8te.text"

      FIXME zero solutions must not crash