Class NSM

java.lang.Object
eu.bandm.music.entities.NSM

public class NSM extends Object
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.

  • Field Details

    • weights

      protected final List<Integer> weights
      Weights as given with the construction.
    • size

      public final int size
      Length of the meter = number of weight positions.
    • isMarked

      protected final boolean isMarked
      Whether this is a MNSM and not a GNSM.
    • indispComputed

      boolean indispComputed
      Flag whether the indispensability has been tried to compute.
    • indispensabilities

      @Opt List<Integer> indispensabilities
      List of indispensability values, in one-to-one correspondance to the list of weights.
  • Constructor Details

  • 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

      public List<Integer> getWeights()
      Return an unmodifiable copy of the list of weights.
    • getWeight

      public int getWeight(int pos)
      Return the weight at the given position.
    • getGroups

      public List<int[]> getGroups()
      Creates lists of startindex and length whenever top-weight appears.
    • checkData

      public static @Opt PreMessage checkData(List<Integer> data)
      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

      public static @Opt List<Integer> parse(String s)
      Utility method which parses decimal digits only.
    • occurenceList

      public List<Integer> occurenceList(int weight)
      Returns a list of all position indexes where the given weight occurs. Result may be empty. The positions are zero-based.
    • subCycle

      public List<Integer> subCycle(int weight)
      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

      public String getNarrowText()
    • relativeDistances

      public List<Integer> relativeDistances(int level)
      Distances of the given level, measured relative to the next lower level.
    • unitDistances

      public List<Integer> unitDistances(int level)
      Distances of the given level, measured relative to the lowest level.
    • differences

      public SortedSet<Integer> differences(int level)
    • 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

      public @Opt List<Integer> 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().