Package eu.bandm.music.comp
Class FieldsFromIntervals
java.lang.Object
eu.bandm.music.comp.FieldsFromIntervals
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<FieldsFromIntervals.Item>
All found fields after executingresolve()
.protected FieldsFromIntervals.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) FieldsFromIntervals
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 inresults
as an XML score block, and combine these into one single scoreElement_score_partwise
.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.Convert one field into a sequence of pitches.void
dump
(PrintStream ps) Print all results found to "ps".void
Print the pitch classes of all its predecessors, followed by that of "i".static <D> void
Args[0] is a set of pcset style intervals.void
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
-
FieldsFromIntervals
public FieldsFromIntervals()
-
-
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(FieldsFromIntervals.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(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 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
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
-