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 writeToTrack(Iterator,int,Track).
FIXME Still missing:
  1. articulation
  2. intensity
  • 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 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 writeToTrack(Iterator,int,Track).
    • repetition_articulation_gap

      protected int repetition_articulation_gap
  • Constructor Details

  • Method Details

    • writeToTrack

      public void writeToTrack(Iterator<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