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 reports about its properties, among others constraints by different authors and indispensability values.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescription(package private) booleanFlag whether the indispensability has been tried to compute.List of indispensability values, in one-to-one correspondance to the list of weights.protected final booleanWhether this is a MNSM and not a GNSM.final intLength of the meter = number of weight positions.Weights as given with the construction. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Opt PreMessageChecks whether the input data is a valid sequence of metric weights.(package private) voidCompute the indispensability values for all positions of the meter.(package private) intcPred(int i) Caculate the cyclic predecessor of the given (zero-based) index.differences(int level) List<int[]> Creates lists of startindex and length whenever top-weight appears.Return an unmodifiable copy of the computed list of indispensability values.intgetIndispensability(int pos) Return the indispensability value at the given position.intgetWeight(int pos) Return the weight at the given position.Return an unmodifiable copy of the list of weights.booleanhendriksMaximalEvenness(int level) booleanisMarked()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.booleanprettyGoodEvenness(int level) relativeDistances(int level) Distances of the given level, measured relative to the next lower level.intsize()Return the length of the meter = the number of weight positions.subCycle(int weight) Returns a list of all position indexes where the given or a lower weight occurs.unitDistances(int level) Distances of the given level, measured relative to the lowest level.
-
Field Details
-
weights
Weights as given with the construction. -
size
public final int sizeLength of the meter = number of weight positions. -
isMarked
protected final boolean isMarkedWhether this is a MNSM and not a GNSM. -
indispComputed
boolean indispComputedFlag whether the indispensability 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. -
isMarked
public boolean isMarked()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. -
getWeight
public int getWeight(int pos) Return the weight at the given position. -
getGroups
Creates lists of startindex and length whenever top-weight appears. -
checkData
Checks whether the input data is a valid sequence of metric weights. Each value in the list must be a non-negative integer. 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. -
subCycle
Returns a list of all position indexes where the given or a lower weight occurs. Result may be empty. The positions are zero-based. -
getNarrowText
-
relativeDistances
Distances of the given level, measured relative to the next lower level. -
unitDistances
Distances of the given level, measured relative to the lowest level. -
differences
-
hendriksMaximalEvenness
public boolean hendriksMaximalEvenness(int level) -
prettyGoodEvenness
public boolean prettyGoodEvenness(int level) -
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().
-
getIndispensability
public int getIndispensability(int pos) Return the indispensability value at the given position.- Returns:
- null if no such list can be computed,
see
computeIndispensabilities().
-