Class FieldsFromIntervals

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

public class FieldsFromIntervals 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.

  • Field Details

  • Constructor Details

    • FieldsFromIntervals

      public FieldsFromIntervals()
  • Method Details

    • allow

      FieldsFromIntervals 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(FieldsFromIntervals.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 FieldsFromIntervals.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(FieldsFromIntervals.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(FieldsFromIntervals.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 <D> void main(String[] args)
      Args[0] is a set of pcset style intervals. The file generated is "fields_.xml" for music xml and "fields_.ly" for lilypond.

      FIXME zero solutions must not crash