Package eu.bandm.music.entities
Class NSM
java.lang.Object
eu.bandm.music.entities.NSM
Notation for Stratified Meters according to Härpfer.
This implementation follows the definition by Bernd Härpfer,
"The Metric Malleability and Ambiguity of Cyclic Rhythms---A
Quantitative Heuristic Approach", Hofheim 2023,
online resource.
An extension which extends the definitions to two, namely
Generic notation for stratified meters (GNSM)
and
measure notation for stratified meters (MNSM) .
is found in Lepper/Härpfer/Trancón
"Härpfer’s Extended Indispensability Algorithm In Z"
online resource.
Each instance can possibly have a list of indispensability values, but this is not possible for all cases. (Currently the first weight may not appear more than four times.)
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) boolean
Flag whether the indispesability has been tried to compute.List of indispensability values, in one-to-one correspondance to the list of weights.protected final boolean
Whether this is a MNSM and not a GNSM.protected final int
Length of the meter = number of weight positions.Weights as given with the construction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Opt PreMessage
Checks whether the input data is a valid sequence of indispensability values.(package private) void
Compute the indispensability values for all positions of the meter.(package private) int
cPred
(int i) Caculate the cyclic predecessor of the given (zero-based) index.Return an unmodifiable copy of the computed list of indispensability values.Return an unmodifiable copy of the list of weights.boolean
Return whether this is a MNSM and not a GNSM.occurenceList
(int weight) Returns a list of all position indexes where the given weight occurs.Utility method which parses decimal digits only.int
size()
Return the length of the meter = the number of weight positions.
-
Field Details
-
weights
Weights as given with the construction. -
size
protected final int sizeLength of the meter = number of weight positions. -
isMeasureAware
protected final boolean isMeasureAwareWhether this is a MNSM and not a GNSM. -
indispComputed
boolean indispComputedFlag whether the indispesability has been tried to compute. -
indispensabilities
List of indispensability values, in one-to-one correspondance to the list of weights.
-
-
Constructor Details
-
NSM
Constructor which takes an array of integer. SeeNSM(java.util.List<java.lang.Integer>)
.- Throws:
IllegalArgumentException
- if the conditions are not met.
-
NSM
Constructor which takes a non-empty list of integer values. Each must be a non-negative integer. All values from zero to the highest contained value must be contained. The first position must contain the highest value. The methodcheckData(List)
can be called in advance.- Throws:
IllegalArgumentException
- if the conditions are not met.
-
-
Method Details
-
size
public int size()Return the length of the meter = the number of weight positions. -
isMeasureAware
public boolean isMeasureAware()Return whether this is a MNSM and not a GNSM. In an MNSM the first value appears only once. -
getWeights
Return an unmodifiable copy of the list of weights. -
checkData
Checks whether the input data is a valid sequence of indispensability values. Each value in the list must be a non-negative integer. All values from zero to the highest contained value must be contained. The first position must contain the highest value.- Returns:
- null if data is valid, otherwise an error messae
-
parse
Utility method which parses decimal digits only. -
occurenceList
Returns a list of all position indexes where the given weight occurs. Result may be empty. The positions are zero-based. -
cPred
int cPred(int i) Caculate the cyclic predecessor of the given (zero-based) index. -
computeIndispensabilities
void computeIndispensabilities()Compute the indispensability values for all positions of the meter. This is not always possible. (Currently the first weight may not appear more than four times.)Attention: in contrast to the IMAGES in the paper, lists here and in the Z formulas are zero-based.
-
getIndispensabilities
Return an unmodifiable copy of the computed list of indispensability values.- Returns:
- null if no such list can be computed,
see
computeIndispensabilities()
.
-