Class Cwn_to_musicXml

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

public class Cwn_to_musicXml extends Object
Creates a simple musicXml output (according to "MusicXML 3.0 Partwise") for one tscore:Part component of one Score_cwn object/s. Usage: construct an instance and call convertVoices() or sim.
FIXME Still missing:
  1. Header data
  2. Set/change Metrum
  3. Ties
  4. Cautionary accidental
  5. lower/upper text
  6. partial measures
  7. whole measure pause
  8. tuplets = open/close proportion
  9. intensity
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    (package private) static final List<eu.bandm.music.small_musicXml.Element_dot[]>
    Local cache containing an arry of n prolongation dots at position n
    protected static final eu.bandm.music.small_musicXml.Element_rest
    Xml element representing a pause
    protected static final eu.bandm.music.small_musicXml.Element_rest
    Xml element representing a "whole measure" pause
    (package private) static final eu.bandm.music.small_musicXml.Element_dot
    Constant xml element representing a prolongation dot.
    protected final Map<MTreeSpec,MSplitter>
    Local cache of one metric splitter each (with its internal cache) per metric tree specifications.
    Target of all messages.
     
    Parameter collection controlling metric split approximation by binary division.
    protected final MTree.CheckedParameters
    Parameter collection controlling metric split beams.
    Parameter collection controlling metric split approximation by synthesis of new divisions.
    Parameter collection controlling metric split dotting, sibling merge, syncopes, etc.
    protected final Score_cwn
    The Score_cwn (corresponding to a tscore PART), which is rendered to one(1) output "score-partwise" with one "part" for each voice.
    protected final String
    Used for indicating the original data source when constructing IDs, etc.
    (package private) static final eu.bandm.music.small_musicXml.Element_note.Seq_2
    Constant xml content, part of an xml "note" element representing an arriving tie.
    (package private) static final eu.bandm.music.small_musicXml.Element_note.Seq_2
    Constant xml content, part of an xml "note" element representing both an arriving and an outgoing tie.
    (package private) static final eu.bandm.music.small_musicXml.Element_note.Seq_2
    Constant xml content, part of an xml "note" element representing an outgoing tie.
    (package private) static final eu.bandm.music.small_musicXml.Element_tied
    Constant xml element representing the graphic aspect if an incomung tie.
    (package private) static final eu.bandm.music.small_musicXml.Element_tied
    Constant xml element representing the graphic aspect if an incomung and at the same time outgoing tie.
    (package private) static final eu.bandm.music.small_musicXml.Element_tied
    Constant xml element representing the graphic aspect if an outgoing tie.
    (package private) static final String[]
    The length of the basic note symbols, in words.
    static final int
    Maximal octave in Midi encoding.
    static final int
    Minimal octave in Midi encoding.
    static final int
    The "small octave", numeric 0, is represented in MIDI encoding by three(3), and "middle c" by four(4).
  • Constructor Summary

    Constructors
    Constructor
    Description
    Only constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    convertOneVoice(Vox voice, List<eu.bandm.music.small_musicXml.Element_part> music_results, List<eu.bandm.music.small_musicXml.Element_score_part> index_results)
    Generate a format for one certain tscore.Vox (possibly including metric info) in musicXml 3.0 "partwise" format.
    eu.bandm.music.small_musicXml.Element_score_partwise
    Generate musicXml output for all voices in Score_cwn.
    eu.bandm.music.small_musicXml.Element_score_partwise
    Generate musicXml output for a selection of Vox elements in score.
    protected static eu.bandm.music.small_musicXml.Element_dot[]
    dots(int dc)
    Return an array of "dc" prolongation dots.
    protected String
    exponent2nodeType(Event ev, int exp)
    Return the name of the basic note duration, as stored in typesByExponent_plus_3, given by the exponent of 1/2.
    protected MSplitter
    Get a metric splitter (with its internal cache) for the given metric tree specifications, or construct a new one.
    static void
    main(String[] args)
    Test application, translates input file "arg[0]" to musicXml output file "arg[1]".
    protected eu.bandm.music.small_musicXml.Element_beam
    makeBeam(String type, int index)
    Make a beam element.
    protected eu.bandm.music.small_musicXml.Element_tuplet
    makeTuplet(Rational p, boolean start)
    Create one bracket element which stands for the start OR the stop of a bracket.
    void
    toXml_metrumChange(List<eu.bandm.music.small_musicXml.Element> formats, BigDecimal barnum)
    Generate the indication of a meter change and of partial measures.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • musicXML_dtd_docId

      public static final XMLDocumentIdentifier musicXML_dtd_docId
    • msg

      Target of all messages. Must be of this type due to tscore.Event.get_location()
    • score

      protected final Score_cwn score
      The Score_cwn (corresponding to a tscore PART), which is rendered to one(1) output "score-partwise" with one "part" for each voice.
    • sourceName

      protected final String sourceName
      Used for indicating the original data source when constructing IDs, etc.
    • parameters_beams

      protected final MTree.CheckedParameters parameters_beams
      Parameter collection controlling metric split beams. Configuration parameter, set once when constructing.
    • parameters_approximate

      protected final MCover.CheckedParameters_approximate parameters_approximate
      Parameter collection controlling metric split approximation by binary division. Iff == null, the binary division will not be applied. Configuration parameter, set once when constructing.
    • parameters_divide

      protected final MCover.CheckedParameters_divide parameters_divide
      Parameter collection controlling metric split approximation by synthesis of new divisions. Iff == null, this method will not be applied. Configuration parameter, set once when constructing.
    • parameters_split

      protected final MSplitter.CheckedParameters parameters_split
      Parameter collection controlling metric split dotting, sibling merge, syncopes, etc. Configuration parameter, set once when constructing.
    • metricSplitters

      protected final Map<MTreeSpec,MSplitter> metricSplitters
      Local cache of one metric splitter each (with its internal cache) per metric tree specifications.
    • const_PAUSE

      protected static final eu.bandm.music.small_musicXml.Element_rest const_PAUSE
      Xml element representing a pause
    • const_PAUSE_MEASURE

      protected static final eu.bandm.music.small_musicXml.Element_rest const_PAUSE_MEASURE
      Xml element representing a "whole measure" pause
    • xml_octave_offset

      public static final int xml_octave_offset
      The "small octave", numeric 0, is represented in MIDI encoding by three(3), and "middle c" by four(4). FIXME UNIFY with OctaveRegister ?!?
      See Also:
    • xml_octave_min

      public static final int xml_octave_min
      Minimal octave in Midi encoding.
      See Also:
    • xml_octave_max

      public static final int xml_octave_max
      Maximal octave in Midi encoding.
      See Also:
    • typesByExponent_plus_3

      static final String[] typesByExponent_plus_3
      The length of the basic note symbols, in words. Indexing goes by the exponent of (1/2) minus three, so at position 0 there is 2^3 = maxima, and at position 3 there is 2^0, the whole note.
    • element_dot

      static final eu.bandm.music.small_musicXml.Element_dot element_dot
      Constant xml element representing a prolongation dot.
    • cache_dots

      static final List<eu.bandm.music.small_musicXml.Element_dot[]> cache_dots
      Local cache containing an arry of n prolongation dots at position n
    • tie_start

      static final eu.bandm.music.small_musicXml.Element_note.Seq_2 tie_start
      Constant xml content, part of an xml "note" element representing an outgoing tie.
    • tie_end

      static final eu.bandm.music.small_musicXml.Element_note.Seq_2 tie_end
      Constant xml content, part of an xml "note" element representing an arriving tie.
    • tie_middle

      static final eu.bandm.music.small_musicXml.Element_note.Seq_2 tie_middle
      Constant xml content, part of an xml "note" element representing both an arriving and an outgoing tie.
    • tied_start

      static final eu.bandm.music.small_musicXml.Element_tied tied_start
      Constant xml element representing the graphic aspect if an outgoing tie. (The semantics are totally unclear and we have not found any specification yet.)
    • tied_end

      static final eu.bandm.music.small_musicXml.Element_tied tied_end
      Constant xml element representing the graphic aspect if an incomung tie. (The semantics are totally unclear and we have not found any specification yet.)
    • tied_middle

      static final eu.bandm.music.small_musicXml.Element_tied tied_middle
      Constant xml element representing the graphic aspect if an incomung and at the same time outgoing tie. (The semantics are totally unclear and we have not found any specification yet.)
  • Constructor Details

  • Method Details

    • getMetricSplitter

      protected MSplitter getMetricSplitter(MTreeSpec mt)
      Get a metric splitter (with its internal cache) for the given metric tree specifications, or construct a new one.
    • toXml_metrumChange

      public void toXml_metrumChange(List<eu.bandm.music.small_musicXml.Element> formats, BigDecimal barnum)
      Generate the indication of a meter change and of partial measures.
      Parameters:
      formats - where to append the resulting xml elements.
      barnum - the number of the bar
    • exponent2nodeType

      protected String exponent2nodeType(Event ev, int exp)
      Return the name of the basic note duration, as stored in typesByExponent_plus_3, given by the exponent of 1/2. So "0" gives a "whole note head" and "3" an Eighth.
    • dots

      protected static eu.bandm.music.small_musicXml.Element_dot[] dots(int dc)
      Return an array of "dc" prolongation dots. Use local cache cache_dots, which means to re-use the Elements.
    • makeTuplet

      protected eu.bandm.music.small_musicXml.Element_tuplet makeTuplet(Rational p, boolean start)
      Create one bracket element which stands for the start OR the stop of a bracket. Set attributes so that both numbers (numerator and denominator) are shown. Normal bracket lines. (No semantic definition could be found. FIXME)
    • makeBeam

      protected eu.bandm.music.small_musicXml.Element_beam makeBeam(String type, int index)
      Make a beam element. Every Element_note contains a "beam*" content particle. This is accumulated in "pending_beams" and finally added to the Element_note.
      Parameters:
      type - the text contents of the result, can be "begin", "end", "continue", "forward-hook", "backward-hook". ("both-hook" seemingly not supported ?)
      index - the value of "@number", which is the identifier (nesting level) for the group of related beam elements.
    • convertOneVoice

      protected void convertOneVoice(Vox voice, List<eu.bandm.music.small_musicXml.Element_part> music_results, List<eu.bandm.music.small_musicXml.Element_score_part> index_results)
      Generate a format for one certain tscore.Vox (possibly including metric info) in musicXml 3.0 "partwise" format. The Vox must be part of the Score_cwn score. Assume all input data (semantic maps in Score_cwn) are valid. Esp. it requires ...
      • that the metric voice has a metric indication at the very first timepoint,
      • that all voices start at the firstTopTp
      • that the very first event in every voice carries CLEF selection
      The fundamental element structure in musicXml is: score_partwise work?, movement? ... etc part-list score-part* part measure* (@number) attributes divisions|key|time|clef // |... direction //????? note (chord,(pitch|unpitched|rest), duration, tie..?, type?, dot*, accidental?, time_modification?, stem?, notehead?, beam, notation* tied, slur, tuplet, dynamics, fermata // ... glissando .. ...//much more: print sound barline ...
        Generation strategy: generate ONE(1) Element_notation in any case,
        and insert close-tuple notations a posteriori.
    • convertVoices

      public eu.bandm.music.small_musicXml.Element_score_partwise convertVoices(List<Vox> voices)
      Generate musicXml output for a selection of Vox elements in score.
    • convertVoices

      public eu.bandm.music.small_musicXml.Element_score_partwise convertVoices()
      Generate musicXml output for all voices in Score_cwn.
    • main

      public static void main(String[] args)
      Test application, translates input file "arg[0]" to musicXml output file "arg[1]".