Class LilypondGenerator

java.lang.Object
eu.bandm.music.haken.LilypondGenerator

public class LilypondGenerator extends Object
Tool for generating one LilyPond source text file from a HKN K-score. The source text is generated by subsequent calls to different service providing methods. It is stored internally as a sequence of Formats. Finally it can be written out to a disk file.
  • Field Details

  • Constructor Details

    • LilypondGenerator

      public LilypondGenerator(MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg)
      Only constructor.
      Parameters:
      msg - targt of all messages.
  • Method Details

    • lilypond_duration_encoding

      public static String lilypond_duration_encoding(RationalDuration.DottedBaseDuration dbd)
      Evident
    • putS

      public void putS(String text)
      Add a particular text as a literal format to vFormats.
    • putF

      public void putF(String text, Object... args)
      Add a particular text after calling String.format(String, Object...) as a literal format to vFormats.
    • putSpace

      public void putSpace()
      Add a special one-blank Format.space to vFormats.
    • putText

      public void putText(String text)
      Add a longer text (including line breaks) to vFormats. This is done using Formats.text(String).
    • addPause

      public void addPause(Rational rat, Vox vpause, Tp tp)
      Add a pause duration to the last emmitted V-Event for later printing the graphic voices. See totalDurations.
    • startGraphEvent

      public void startGraphEvent(Rational rat)
      Append the duration of a generated V-Voice event to the list of complete durations totalDurations. See there for details.
    • writeGraphics

      protected void writeGraphics(String role, Vox inputVoice, List<RelWert> expanded, List<Tp> tps, Map<Event,RelWert> event2relwert, Map<Event,Haken> event2haken, Map<Event,DoppelHaken> event2doppelHaken)
      Append a dedicated lilypond voice to the score, which presents a graphic symbol of the underlying K-event. This voice is synchronuous to the corresponding V-events, which have just been written into a lilypond E-voice.
      Parameters:
      role - Only for generating lilypond source text comment: For what parameter this voice has been used.
      inputVoice - for getting the original K-events when stepping through the time points (and for inserting the voice name into the lilypond source text comment)
      expanded - list of all expanded values, coming from the Score_hkn.Expansion and in sync with tps.
      tps - list of all collected and synthesized time points, coming from the Score_hkn.Expansion and in sync with expanded.
      event2relwert - links possibly a K-event to a RelWert, coming from Score_hkn.
      event2haken - links possibly a K-event to a Haken, coming from Score_hkn,
      event2doppelHaken - links possibly a K-event to a Doppelhaken, coming from Score_hkn.
    • writeGraphics

      void writeGraphics(Haken h)
      Add the macro call to the lilyPond source which creates the graphik of a Haken.
    • writeGraphics

      void writeGraphics(DoppelHaken h)
      Add the macro call to the lilyPond source which creates the graphik of a DoppelHaken. This is slightly different when internally overlapping and not-overlapping, e.g. "OMO" vs. "OMMO".
    • writeGraphics

      void writeGraphics(RelWert w)
      Add the macro call to the lilyPond source which creates the graphik of a directly given RelWert (without any Haken).
    • writeGraphicsValueString

      void writeGraphicsValueString(String s)
      Aux method to add the macro call print the name of a RelWert. This canbe directy given or part of a Haken expansion.
    • writeGraphicsExpanded

      void writeGraphicsExpanded(RelWert r)
      Method which print the graphic represention of the currently valid RelWert for all V-events which are not the first in the K-event expansion.
    • open

      public void open(String inputFileName, String outputFileStem, String subtitle)
      Write the very beginnig of generated lilypond source file. This includes generation documentation comment line, paper and header blocks, additional free components as previously entered into preamble_definitions.
    • open_score

      public void open_score()
      Append the LilyPond source text to open a score.
    • open_staffGroup

      public void open_staffGroup()
      Append the LilyPond source text to open a staff group.
    • open_staff

      public void open_staff(String longname, String shortname)
      Append the LilyPond source text to open a staff.
    • close_staff

      public void close_staff()
      Append the LilyPond source text to close a staff.
    • close_staffGroup

      public void close_staffGroup()
      Append the LilyPond source text to close a staff group.
    • close_score

      public void close_score()
      Append the LilyPond source text to close a score.
    • writeToFile

      public void writeToFile(String outputfilename)
      Write all accumulated LilyPond source text to the given file.