Class Score_cwn

java.lang.Object
eu.bandm.music.top.Score_cwn

public class Score_cwn extends Object
This class realizes a first simple example instantiation of a tscore TimeScape for representing "common western notation" / "CWN" musical scores. One(1) instance of this class corresponds to one(1) "PART" in a tscore file.
It imposes the following properties:
  • The TpTop top level time points are labeled mostly with *integral* numbers, in continuously increasing order. These can be seen as "measure numbers", but may be based anywhere. Every segment between two adjacent top level Tp labels is meant as one musical measure. Most measures are "complete", but there may be "incomplete" measures, eg. for upbeats and for to carry repetition bars.
  • There is one dedicated global metric voice named "M". Its main parameter is the metrum. There must be at least ONE event at the beginning of the score, on the very first event, which specifies the metrum of the first bar.
  • Metrum specifications are only allowed on the "beat one" of each measure, except in the very first measure.
  • Metrum specifications are firstly only "names" for meter. At each first appearance, a second parameter track named "mtree" must give a definition according to the syntax defined in MTree.
  • This global voice "M" may have a second parameter track, called "tempo", or further tracks for overall parameters like "general espression directives", etc.
  • All further voices hold the data for some instrument taking part in the music. They use some pitch class with "running octave" as a their main parameter.
  • They may have a second track "nota" containing notation specs, like clefs and keys, and/or a track "artik" for articulation etc. The very first event must have a nota-event specifying the key. ((FIXME schlagzeug?Horn?))
  • "volume" (aka "loudness", "intensity", "dynamics") is STILL MISSING FIXME.
  • Field Details

    • msgr

      final MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msgr
      The drain for all messags.
    • msg

      final SimpleMessage.Sender<eu.bandm.tools.util.xml.XMLDocumentIdentifier> msg
      Only for conveniently construction messages and sending them to msgr
    • part

      public final Part part
      The score data as (in most cases) parsed by tscore. It is needed as public for all programs which synthesize scores.
    • language

      final String language
      Human language in which the tscore input will be interpreted. Esp. the pitch classes and key names.
    • modifiers

      public static final Modifiers modifiers
      Modifiers controlling the parsing process.
    • voicename_metric

      public static final String voicename_metric
      The name of the mandatory global "metric" voice.
      See Also:
    • paramname_metric

      public static final String paramname_metric
      Metric specifications are the main events in the global metric voice. Therefore they have no explicit parameter name, but Event.main_parameter_name.
      See Also:
    • paramname_mtree

      public static final String paramname_mtree
      Name of the parameter track of the main metric voice with metric tree formulas.
      See Also:
    • paramname_articulation

      public static final String paramname_articulation
      Name of the parameter track of a normal voice carrying articulation marks.
      See Also:
    • paramname_nota

      public static final String paramname_nota
      Name of the parameter track of a normal voice carrying notation (meta-) information.
      See Also:
    • paramname_verba

      public static final String paramname_verba
      Name of the parameter track of a normal voice carrying "lyrics" / text syllables.
      See Also:
    • parse_barNumber

      public static final Translet.Parser<BigDecimal> parse_barNumber
      Parser for measure numbers accept a non-negative integer, and maybe a decimal point with a fractional part.
    • checkDistance

      public static final Function3<Comparator<? super BigDecimal>,BigDecimal,BigDecimal,String> checkDistance
      Checks that two consecutive time points are (a) strictly increasing, but (b) not more than "1.0" distant.
    • meterVoice

      public Vox meterVoice
      The global voice vor metric, tempo, and global expression information. Will be identified by its name voicename_metric.
    • decimal2tpTop

      public final SortedMap<BigDecimal,TpTop> decimal2tpTop
      Maps bar numbers / measure numbers to tscore top-leve time points.
    • tpTop2decimal

      final Map<TpTop,BigDecimal> tpTop2decimal
      Inverse of decimal2tpTop.
    • tp2rat

      public final Map<Tp,Rational> tp2rat
      Maps all tscore time points to rational numbers which correspond to the musical time relative to the start of the very first event. This this time point notion is notrelated to the measure numbers.
    • firstTp

      public TpTop firstTp
      The very first time point of the score. (Must be a toplevel time point due to the syntax of the general tscore format.)
    • lastTp

      public TpTop lastTp
      The very last time point of the score. This must not carry an event but mark the end-time of the very last event in any voice. (Must be a toplevel time point due to the syntax of the general tscore format.)
    • lastTpTop_rat

      @Opt public @Opt Rational lastTpTop_rat
      The rational time point of the very last top level tscore time point. See tp2rat.
    • event2tempo

      final Map<Event,Tempo> event2tempo
      Maps events from the global "M" voice to a tempo indication.
    • rat2tp

      public final Multimap<Rational,Tp> rat2tp
      Inverse of tp2rat.
    • event2endtp

      final Map<Event,Tp> event2endtp
      Maps events to their end time point.
    • pause

      public final Map<Event,String> pause
      Marks voice events as being a pause.
    • holds

      public final Map<Event,String> holds
      Marks voice events as being a "hold", which is an unaltered prolongation of the preceding event
    • event2pitch

      Maps voice events to one nominal pitch. (FIXME: CHORDS with MORE THAN ONE pitch are currently not supported.
    • eventHasFullAccidental

      final Map<Event,String> eventHasFullAccidental
      Whether an accidental is requested explicitly by the tscore source, in the param track called paramname_nota. The terminal symbol is fixed to "!", which is inspired by lilypond.

      FIXME should be for PITCH, not for EVENT!! Current solution ASSUMES each Event has only ONE(1) Pitch!!

    • eventHasCautionaryAccidental

      final Map<Event,String> eventHasCautionaryAccidental
      Whether a cautionary accidental is requested explicitly by the tscore source, in the param track called paramname_nota. The terminal symbol is fixed to "?", which is inspired by lilypond.

      FIXME should be for PITCH, not for EVENT!! Current solution ASSUMES each Event has only ONE(1) Pitch!!

    • event2artikulation

      final Map<Event,Artikulation> event2artikulation
      Artikulation parsed from the param track called paramname_articulation.
    • event2ornamentation

      final Map<Event,Ornament> event2ornamentation
      Ornamentation parsed from the param track called paramname_articulation.
    • legatos

      final Multimap<String,EventSet> legatos
      Event sets standing for legato arcs, parsed from the param track called paramname_articulation.
    • clefPrefix

      final String clefPrefix
      Prefix in the source text for a clef indication.
      See Also:
    • event2clefUsage

      public final Map<Event,ClefUsage> event2clefUsage
      Maps events of sounding voices to a clef change, from param track .
    • event2key

      final Map<Event,FunctionalKey> event2key
      Maps events of sounding voices to a key change, from param track .
    • event2staffUsage

      public final Map<Event,Integer> event2staffUsage
      Explicit hint for printing, when multiple voices share one staff. -1 = "I am solo" 0 = "I am pausing" 1,2,3,4 = "I am voice number 1,2,3,4"
    • motifs

      final Multimap<String,EventSet> motifs
      Groups of events collected to represent "analytical brackets" for motifs, etc. From param track paramname_nota.
    • event2lowerText

      public final Map<Event,String> event2lowerText
      Additional text to be printed below the rendering of a note.
    • event2upperText

      public final Map<Event,String> event2upperText
      Additional text to be printed above the rendering of a note.
    • event2verba

      public final Map<Event,String> event2verba
      Maps events of a sounding voice to a lyric syllable.
    • measures

      public final MeasureCollector<MetrumName> measures
      Collector for the meter names and duration indications in the main metric voice "M".
    • mTreeCollector

      protected MTreeCollector<MetrumName> mTreeCollector
      Collector for the meter specifications in the main meter voice (mandatory) and in sounding voice (optional).
  • Constructor Details

    • Score_cwn

      public Score_cwn(Part part, String lang, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msgr)
      Service providing main factory method for converting a particular PART of a TimeScape.
      Parameters:
      lang - the human language to interpret pitch classes etc.
    • Score_cwn

      public Score_cwn(TimeScape ts, String lang, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msgr)
      Service providing main factory method for converting the one and only "PART" section of the given tscore input Timescape.
      Parameters:
      lang - the human language to interpret pitch classes etc.
  • Method Details

    • multipleParts

      public static Map<String,Score_cwn> multipleParts(TimeScape ts, String lang, MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msgr)
      Service providing main factory method for converting all "PART" sections in the given tscore input Timescape. Returns a map of Score_cwns by the names of the tscore parts.
      Parameters:
      lang - the human language to interpret pitch classes etc.
    • update

      public void update()
      Translate untyped tscore data into semantically sensible "common western notation", and verify that all constraints are met. This method READS the event lists contained in TimeScape->voices->bySourceOrder and WRITES to all the local Map and Set output data declared locally.

      Extending the score format is done by sub-classing this class with an "update" method starting with "super.update()". After this, additional tracks can be parsed into additional parameter containers.
      Furthermore, the update process is divided into different methods to be overridden selectively:

          update()
          ->  update_topTps()
          ->  update_metric()
           -> update_voices()
                -> update_voice(v)
                      -> update_voice_durations(v)
                      -> update_voice_pitches(v)
                      -> update_voice_articulations(v)
                      -> update_voice_notations(v)
                      -> update_voice_ornaments(v) // _and_Articulations
                      -> update_voice_lyrics(v)
        
        

      The parsing of a particular track "X" can be changed by overriding the sub-method "parse_track_X()". <---- FIXME MISSING!

    • update_voices

      public void update_voices()
      FIXME DOCME
    • update_meterVoice

      public void update_meterVoice(Vox v)
      FIXME DOCME For ADDITIONAL global directices (=events) contained in the main meter voice.
    • update_voice

      public void update_voice(Vox v)
      FIXME DOCME
    • extra_tracks

      protected void extra_tracks(Vox v)
      Hook method to extend this class to parse additional parameter tracks contained in the input source text. For each of these tracks the data stores must be provided. This method is called at the end processing every single voice If it is overridden, the code must start with super.extra_tracks(v), to allow sub-classing from sub-classes.
    • update_topTps

      protected void update_topTps()
      First step of interpreting syntactic to semantic contents: parse the TpTop text to bar numbers, constructing an ordered sequence of TpTops:
    • update_metric

      protected void update_metric()
      Second step of interpreting syntactic to semantic contents: parse the Metric voice and collect metra and durations.
    • update_voice_durations

      public void update_voice_durations(Vox v)
      FIXME DOCME
    • update_voice_pitches

      public void update_voice_pitches(Vox v)
      FIXME DOCME
    • update_voice_articulations

      public void update_voice_articulations(Vox v)
      FIXME DOCME
    • update_voice_notations

      public void update_voice_notations(Vox v)
    • update_voice_lyrics

      public void update_voice_lyrics(Vox v)
    • normalizeEvents

      public PrimeFactors normalizeEvents(Vox voice, Predicate<Event> mergePauses, Predicate<Event> mergeSounds, List<Event> events, List<QualifiedRational> evStarts, List<Boolean> repeats)
      Step through the voice, remove "hold" symbols by the prolongating the preceding (sounding) event, merge adjacent "pause" events, and calculate the required sub-division of a quarter for the midi realization of all. Checks additionally that the very first symbol has a clef and is not a "hold". Results are returned in three lists which are indexed in sync.

      (currently 20180310 only used in Cwn_to_{lilypond,musicxml} !! FIXME make idempotent!
      FIXME merge pause only with preceding pause if not attributed (provide predicate as functional arg)

      Parameters:
      voice - the voice to process (the time points to step through the voice are in the global field rat2tp.
      mergePauses - whether adjacent pauses shall be merged.
      events - OUTPUT parameter: list of all filtered events
      evStarts - OUTPUT parameter: list of the starting time points of the filtered events
      repeats - OUTPUT parameter: whether the event has the same pitch as its predecessor WIRD NICHT UNBEDINGT GEBRRAUCHT / WIEDER RAUS ??? FIXME
      Returns:
      the lowest common multiple of all occuring time divisions. (Needed e.g. to set the time granularity "ppq" for a midi encoding.)
    • normalizeEvents_midi_PPQ

      public int normalizeEvents_midi_PPQ(Vox voice, Predicate<Event> mergePauses, Predicate<Event> mergeSounds, List<Event> events, List<QualifiedRational> evStarts, List<Boolean> repeats)
      Execute normalizeEvents(Vox,Predicate,Predicate,List,List,List), but return the lcm of all duration numerators in the form required for Midi "Parts per quarter".
    • initialTempo

      @Opt public @Opt Tempo initialTempo()
      DOCME
    • dumpVoice

      public void dumpVoice(PrintStream ps, Vox voice)
      Debugging print which prints only the time point and the pitch, if it is not the metric voice.
    • dump

      public void dump(PrintStream ps)
      Debugging print which prints all voices. FIXME timeless data auch !!?!
    • dump

      public void dump()
      Debugging print which prints all voices. FIXME timeless data auch !!?!
    • makeTp

      public Tp makeTp(Rational when, @Opt eu.bandm.tools.location.Location<eu.bandm.tools.util.xml.XMLDocumentIdentifier> origLoc)
      Add a new time point at the given rational time value, if no such already exists.
    • addCompleteMeasure

      public void addCompleteMeasure(int den, int nom, @Opt @Opt MTreeSpec mt)
      Append at the end of all measure specifications a new measure with the given name (looking like "den/nom") and MTree specification.
    • addCompleteMeasure

      public void addCompleteMeasure(MetrumName name, @Opt @Opt MTreeSpec mt)
      Append at the end of all measure specifications a new measure with the given name (looking like "den/nom") and MTree specification. Iff the mtreespec !=null, then this measure will be treated as "explicit measure indication". FIXME, this seems rather arbitrary!?!
      FIXME there is a fixme in MeasureCollector.addCompleteMeasure(MetrumIndication).