Class Cwn_to_midi

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

public class Cwn_to_midi extends Object
Creates a simple midi file output, based on the javax.sound.midi runtime classes for one tscore "PART" component of one Score_cwn object. Usage: construct an instance and call
invalid reference
#writeToTrack(Iterator,int,Track)
.
FIXME Still missing:
  1. articulation
  2. intensity
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final Rational
    ticksPerRationalOne as a Rational.
    protected int
     
    protected final Score_cwn
    The Score_cwn (corresponding to a tscore PART), which is rendered by the subsequent calls to
    invalid reference
    #writeToTrack(Iterator,int,Track)
    .
    protected final Sequence
    The one and only midi sequence object filled successively by this converter.
    protected final int
    How many "midi ticks" fall into one CWN "whole note", which corresponds to the Rational duration "1/1".
  • Constructor Summary

    Constructors
    Constructor
    Description
    Cwn_to_midi(Score_cwn score, int ticksPerRationalOne)
    Usage: construct an instance with one Score_cwn, then for each voice call createTrack() and
    invalid reference
    #writeToTrack(Iterator,int,Track)
    .
  • Method Summary

    Modifier and Type
    Method
    Description
    Return a newly constructed midi Track object in the (overall) midi Sequence object of this converter.
    Return the one and only Sequence object of this converter.
    static void
    main(String[] args)
    Test method, translates input file "arg[0]" to midi output file "arg[1]".
    void
    writeToTrack(Iterable<Event> data, int channelNumber, Track track)
    Encode the sequence of events as given by "data" into the midi Track object given by "track".

    Methods inherited from class java.lang.Object

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

    • ticksPerRationalOne

      protected final int ticksPerRationalOne
      How many "midi ticks" fall into one CWN "whole note", which corresponds to the Rational duration "1/1".
    • RAT_ticksPerRationalOne

      protected final Rational RAT_ticksPerRationalOne
      ticksPerRationalOne as a Rational.
    • sequence

      protected final Sequence sequence
      The one and only midi sequence object filled successively by this converter. Is constructed when this converter is constructed, and holds all the Track objects which will be constructed by createTrack() and will be filled by
      invalid reference
      #writeToTrack(Iterator,int,Track)
      .
    • score

      protected final Score_cwn score
      The Score_cwn (corresponding to a tscore PART), which is rendered by the subsequent calls to
      invalid reference
      #writeToTrack(Iterator,int,Track)
      .
    • repetition_articulation_gap

      protected int repetition_articulation_gap
  • Constructor Details

  • Method Details

    • writeToTrack

      public void writeToTrack(Iterable<Event> data, int channelNumber, Track track) throws InvalidMidiDataException
      Encode the sequence of events as given by "data" into the midi Track object given by "track".

      IF Sequence.getDivisionType() = PPQ = Pulse Per Quarter THEN all timing info is given in "notation time". The effectice physical time results from the current "musical tempo", which is "quarters per second" or sim.
      ATTENTION assume "Hold" events are normalized.

      FIXME artikulation: verkürzung / legato-erkennung etc. fehlt

      Throws:
      InvalidMidiDataException
    • createTrack

      public Track createTrack()
      Return a newly constructed midi Track object in the (overall) midi Sequence object of this converter.
    • getSequence

      public Sequence getSequence()
      Return the one and only Sequence object of this converter. In this, all cwn data will be encoded in single Track objects. It can be written to a disk file as a whole (by MidiSystem.write(Sequence,int,File)), or be given to some Midi player software as input data, etc.
    • main

      public static void main(String[] args) throws InvalidMidiDataException
      Test method, translates input file "arg[0]" to midi output file "arg[1]".
      Throws:
      InvalidMidiDataException