Package eu.bandm.music.comp
Class Fields
java.lang.Object
eu.bandm.music.comp.Fields
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
Modifier and TypeClassDescriptionprotected class
Each Item represents one construction step of a field. -
Field Summary
Modifier and TypeFieldDescriptionThe set of allowed intervals.protected final List<Fields.Item>
All found fields after executingresolve()
.protected Fields.Item
The start element of the fields' tree, representing a field with just one pitch =0. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescription(package private) Fields
allow
(int i) Add a further interval to the set of allowed intervals.int[]
asArray
(Fields.Item item) 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 inresults
as an XML score block, and combine these into one single scoreElement_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.asPitches
(Fields.Item item, TwelveToneFunctionalRepresentation repr) Convert one field into a sequence of pitches.void
dump
(PrintStream ps) Print all results found to "ps".void
dump
(PrintStream ps, @Opt Fields.Item i) Print the pitch classes of all its predecessors, followed by that of "i".static void
Test application, allowed intervals must be added in the source text, result is always written into "TESTOUT.xml"void
prolongate
(Fields.Item start) If the Item / field represented by the itme has already 12 / all pitch classes, then store it inresults
.void
resolve()
Central service provider: Create a root note and prolongate it with 11 successors to complete fields.
-
Field Details
-
allowedIntervals
The set of allowed intervals. Set incrementally byallow(int)
after constructing this instance. -
results
All found fields after executingresolve()
. -
root
The start element of the fields' tree, representing a field with just one pitch =0.
-
-
Constructor Details
-
Fields
public Fields()
-
-
Method Details
-
allow
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
If the Item / field represented by the itme has already 12 / all pitch classes, then store it inresults
. 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 callprolongate(Item)
recursively. -
dump
Print all results found to "ps". -
dump
Print the pitch classes of all its predecessors, followed by that of "i". -
asPitches
public List<PitchAndOctave<OctaveRegister,FunctionalPitchModOctave>> asPitches(Fields.Item item, TwelveToneFunctionalRepresentation repr) Convert one field into a sequence of pitches. This is normally applied to fields contained inresults
.- Parameters:
item
- represents the fieldrepr
- 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
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 inresults
as an XML score block, and combine these into one single scoreElement_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 printnumber
- the number which appears in the name of the "part"/voice/staffmusic_results
- where to append the "Element_measure" which contains the notesindex_results
- where to index entry to this new staff
-
main
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
-