public class MSplitter extends Object
MTreeSpec
, and the notation style
as a set of parameters, realized as instance of MSplitter.Parameters
,
MTree.Parameters
, MCover.Parameters_approximate
and MCover.Parameters_divide
.
RationalDuration.DottedBaseDuration
, representing
the note heads, additional beaming information and tuplet brackets.
MCover
,
and (b) merging these nodes to "dotted notation" or "sibling merge" etc., for
stylistic or ergonomic reasons.
Trie
.
MTreeSpec
and the Parameter objects.
These are:
MTree.Parameters
, to modify the appearance of
beams and brackets.MCover.Parameters_divide
or
MCover.Parameters_approximate
. This
is passed down to MCover
to specify the kind of automated MTree expansion.
MSplitter.Parameters
instance specifies the further processing of the
initial coverage by merging, dotting, etc.process(List)
/ process(List,List)
.
This returns a MSplitter.Result
object (possibly from cache).
From this, an inner instance of MSplitter.Result.WriteOut
must be constructed and the
abstract methods overridden to the desired behaviour; finally its
MSplitter.Result.WriteOut.process()
method is called.
Modifier and Type | Class and Description |
---|---|
static class |
MSplitter.Parameters
The parameters for the post-processing of found covers.
|
class |
MSplitter.Result
Represents one result of processing a sequence of qualified durations.
|
Modifier and Type | Field and Description |
---|---|
protected Trie<QualifiedRational,MSplitter.Result> |
cache
Cache which holds the split result for each particualr sequence of qualified Rationals.
|
protected Trie.Evaluator<QualifiedRational,MSplitter.Result> |
cacheEvaluator
Operator on
cache , needed for entering and retrieving cached keys and values. |
protected Map<Integer,List<Integer>> |
freeSectionings_int
Internal cache.
|
protected Map<Rational,List<RationalDuration.DottedBaseDuration>> |
freeSectionings_rat
Internal cache.
|
protected MTree |
metricTree
The growing metric tree.
|
protected MCover.Parameters_approximate |
parameters_approximate
Parameters for the "binary approximation" mode.
|
protected MCover.Parameters_divide |
parameters_divide
Parameters for the "auto-divide" mode.
|
protected MSplitter.Parameters |
parameters_explicit
The parameters controling sibling merge, dotting, syncopas and hemiolas.
|
protected Map<MTree,List<MTree>> |
pause_displays
FIXME ????
|
protected Map<MTree,List<MTree>> |
sound_displays
FIXME ????
|
protected boolean |
topBracketIsVanishing
Whether the top-level node has a vanishing brackt.
|
Constructor and Description |
---|
MSplitter(MTreeSpec metricTreeSpec)
Simplified constructor, setting all to default but the metric tree spefication.
|
MSplitter(MTreeSpec metricTreeSpec,
MTree.Parameters parameters_brackets,
MCover.Parameters_approximate parameters_approximate,
MCover.Parameters_divide parameters_divide,
MSplitter.Parameters parameters_explicit)
Full constructor, specifying all parameters.
|
Modifier and Type | Method and Description |
---|---|
(package private) List<MTree> |
find_symbol_sequence(MTree node,
Rational duration,
boolean isSound)
Convert a node into one or more notation symbols.
|
protected List<Integer> |
freeSectioning_params(int i)
Cuts the numerator of any duration value (the denominator being some
power of two) into sums of minimal number of summands
which can be written only with basic note symbol and prolongation dots
("e-writable").
|
protected List<RationalDuration.DottedBaseDuration> |
freeSectioning_params(Rational rat)
Delivers a list of
RationalDuration.DottedBaseDuration which add up to the
given duration value. |
MTree |
get_metricTree()
Returns the metric tree in its current state, as modified by all preceding
metric splitting tasks.
|
protected void |
parseSiblingsAndDottings(List<MTree> irep,
boolean isPause,
Set<MTree> printThem,
Map<MTree,StemEnd> stemEnds)
Delivers all nodes which shall appear in the notation as a symbol, in the
set argumente "printThem".
|
MSplitter.Result |
process(List<QualifiedRational> eventStarts)
Main entry method: process the (ascending) list of start time points and
deliver a semantically sensible rendering plan.
|
MSplitter.Result |
process(List<Rational> eventStarts,
List<Boolean> isSound)
Main entry method: process the (ascending) list of start time points and
deliver a semantically sensible rendering plan.
|
(package private) void |
splitDots_withBeams(List<MTree> irep,
Set<MTree> printThem,
Map<MTree,StemEnd> stemEnds,
int dotCounts,
boolean dotCountsIsMax,
int startPos,
int endPos,
boolean leftNotRight,
boolean positiveDotting)
Add nodes from Initial Coverage to result, representing a sequence
of dotted values not exceeding maxDots.
|
protected boolean |
testForSyncopeAndHemiola(List<MTree> irep)
Returns whether the node list, representing one event, can be replaced
by one single symbol, due to syncope or hemiola rules.
|
protected final MTree metricTree
protected final boolean topBracketIsVanishing
protected final MSplitter.Parameters parameters_explicit
@Opt protected final MCover.Parameters_divide parameters_divide
@Opt protected final MCover.Parameters_approximate parameters_approximate
protected Trie<QualifiedRational,MSplitter.Result> cache
protected final Trie.Evaluator<QualifiedRational,MSplitter.Result> cacheEvaluator
cache
, needed for entering and retrieving cached keys and values.protected final Map<Rational,List<RationalDuration.DottedBaseDuration>> freeSectionings_rat
protected final Map<Integer,List<Integer>> freeSectionings_int
0 0001 A 0 0001 A 0 0001 A 0 0001 A 0 0100 B 0 0100 B 0 1100 B 0 0100 B + 1 0000 C + 10 0000 C + 10 0000 C +100 0000 C --------- --------- --------- --------- 1 0101 21 10 0101 37 10 1101 45 100 0101 69 0 0011 0 0011 0 0011 0 0011 0 0100 0 0100 0 1100 0 0100 + 0 1110 + 01 1110 + 1 1110 + 11 1110 --------- --------- --------- --------- 1 0101 1 0101 10 1101 100 0101 0 0111 7 0 0111 7 0 1111 15 0 0111 7 + 0 1110 14 + 1 1110 30 + 1 1110 30 + 11 1110 62 --------- --------- --------- --------- 1 0101 21 1 0101 37 10 1101 45 100 0101 69
public MSplitter(MTreeSpec metricTreeSpec)
public MSplitter(MTreeSpec metricTreeSpec, MTree.Parameters parameters_brackets, @Opt MCover.Parameters_approximate parameters_approximate, @Opt MCover.Parameters_divide parameters_divide, MSplitter.Parameters parameters_explicit)
metricTreeSpec
- the specification of the metric treeparameters_brackets
- rules how to insert proportional brackets and beamsparameters_approximate
- rules for the "binary approximation" modeparameters_divide
- rules for the "synthesize divisions" modeparameters_explicit
- rules for sibling merge, dotting, syncopes etc.public MTree get_metricTree()
List<MTree> find_symbol_sequence(MTree node, Rational duration, boolean isSound)
RationalDuration.DottedBaseDuration
) is already stored
with the node, different for sound and silence.
Otherwise a free sectioning is constructed and the beams are calculated.
The results are cached.public MSplitter.Result process(List<Rational> eventStarts, List<Boolean> isSound)
process(List)
.public MSplitter.Result process(List<QualifiedRational> eventStarts)
MTree
"this" MSplitter
which must be printed to get a minimal
representation in note symobles according to some historical
standard note writing patterns. These patterns are called "siblings",
"dottings", "syncopes" and "hemiolas". The simplification step is called "merging".
MTree
.
syncope = closed pattern. The duration which is exactly as long as the parent metric node, but the event starts later. pTop / / / \ \ \.. toplevel: any division possible / \ p p2 p and its follower p2 must have identical lengths / \ / \ and div-counts (2 or 3 only!) [----[ index of start and follower identical > 0 (will be applied only if p.duration is D-writable (e.g. for 15/16). In case of p.div==2, the pattern may stretch over more than one intermediate levels, limited by max_level_syncope_2 positive dotting pTop / / \ \ / x identical lengths on all levels / / \ x.div==2 required (but not for pTop.div) / x maximal dot count is limited by max_dots_positive. / / \ if exceeded, push dots up or down [----------[ negative dotting pTop / \ \ \ x \ identical lengths on all levels / \ \ x.div==2 required (but not for pTop.div) x \ maximal dot count is limited by max_dots_negative / \ \ if exceeded, push dots up or down [--------] sibling fusing (p.div >2) p / | \ - x x ident.length, n*x.duration must be D-writeable [----] x - x [----]In all patterns: Differences in the duration between siblings (candidates or parents of candidates) are ALWAYS A BARRIER. Differences in their division number, i.e. internal structure, in general are NOT.
MSplitter.Result.additionalProportions
, which must
be considered when programming any later write-out procedure.
P 2*3*(1/4) / \ P P / | \ / | \ x x X. Xz z P | 3*2*(1|4) / | \ P Q P / | / \ | \ /\ x x X. Xz z P 2*2*(1/4) / \ P P / \ / \ x X. X z P | 4*1/4 / / \ \ /\ x X. X z P | 1/4+(2*1/4)+1/4 / | \ / Q \ / / \ \ x X. X z etc. 5*2*1/4|1/4+4*2*1/4+1/4 5*2*1/4|1/4+2*1/4+1/4+3*2*1/4|1/2+1/4+2*1/4+1/4+2*1/2| etc.
protected boolean testForSyncopeAndHemiola(List<MTree> irep)
irep
- the initial representation, which shall be simplifiedvoid splitDots_withBeams(List<MTree> irep, Set<MTree> printThem, Map<MTree,StemEnd> stemEnds, int dotCounts, boolean dotCountsIsMax, int startPos, int endPos, boolean leftNotRight, boolean positiveDotting)
negative positive N N i=in Initial Coverage / \ / \ N Xi Xi N / \ / \ N Xi Xi N / \ / \ N Ni Ni X ---][^^^^^^^^^^^] [^^^^^^^^^]The whole interval of nodes is given by startpos to endpos (INCLUSIVE). LeftNotRight says on which side to begin the grouping, i.e. on which side the most dots will be found if splitting them is necessary.
protected void parseSiblingsAndDottings(List<MTree> irep, boolean isPause, Set<MTree> printThem, Map<MTree,StemEnd> stemEnds)
ppp / / \ \ \ n n+ pp pp / \ / \ / \ n p / \ / \ n [-------------------] positive dotting [----------------------] double pos. dotting [-------------] siblings [------------------] ppp / / \ \ \ +pp n n / \ / \ / \ +p n / \ n n [--------------] double neg. dotting [-----] negative dotting [--------------] siblings jumps over more than one level => no simplification is possible! ppp / / \ \ \ pp N pp \ / \ / \ p p / \ / \ n n [---------] [-------------]In a first step for every node (not the very first) the kind of
Move
is
determined:
up-up-..-hori-hori-.. down-down pp / \ \ \ / \ \ \ p [] [] p / \ -------- / \ [] / hori \ [] /up \ down i0 i1 i2 i3 .... i0 again phase 0 1 3 4=flush i1 = last of neg.dot, first of siblings i2 = last of siblings, first of pos dot (iff any!)But there may be more of these patterns, if they are partial and separated by jumps in the hierarchy:
--up--up .... up--hori--down hori-down / / \ P P P / \ / \ p p / | \ q q q /\ X [---------------------------------](After a down can never come an up, because this would imply a GAP in the time cover.)
protected List<RationalDuration.DottedBaseDuration> freeSectioning_params(Rational rat)
RationalDuration.DottedBaseDuration
which add up to the
given duration value.
The calculation of this list is controlled by style parameters,
therefore the cache must be maintained specifically, with this MSplitter instanve.protected List<Integer> freeSectioning_params(int i)
27 ^ 0001 1011 ^ 3*8 + 3*1 ---- = 2 = --- --- = dotted whole plus dotted eighth 16 16 16Some exceptions are hard-wired, see the initialization block above. The limits on dot counts and rule for dot grouping is controlled by
parameters_explicit
,
therefore this cache must be local to this MSplitter instance.