Class CwnToFloatSig_basic<S extends Score_cwn>

java.lang.Object
eu.bandm.music.top.CwnToFloatSig_basic<S>
Direct Known Subclasses:
CwnToFloatSig_withComment, CwnToFloatSig_withOrnament

public class CwnToFloatSig_basic<S extends Score_cwn> extends Object
Creates as output a basic sig sequencer data to be put into a CwnSequencerFloat, etc. Has dual use outputs: files (for external use) and arrays (for internal use). When arrays are *not* generated, one and the same instance can be used for different voice objects. Otherwise, one new instance per voice is necessary.

Given a file name stem like "XXX_" it generates one binary file with name "XXX_VVV.sig" and one logically identical text file "XXX_VVV.sig.text" for a voice named "VVV".

The data is a table = a sequence of tuples, with the following format:

  1. Float start time point ("onset")
  2. int event number: its changes are trigger information for the envelope
  3. byte octaves coordinate (relative to c'/C4))
  4. byte fifths coordinate (relative to c'/C4))
  5. PRE20230218 byte octave register (midi style)
  6. PRE20230218 byte stammton
  7. PRE20230218 byte versetzung (signed)
  8. PRE20230218 byte fifth Euler coordinate
  9. PRE20230218 byte third Euler coordinate
  10. Float duration
  11. byte volume ?????
  12. byte articulation (0=legato, incr=shorter)

   tscore:TimeScape 
       Part        ----> ScoreCwn ---+  --->       OR     --> CwnToDoubleSig_:basic
         Vox             |           |        CwnToSig_basic          --> Disk Files
         Vox             +-----------|        CwnToSig_basic          --> Disk Files
       Part
         Vox
         Vox
  
  • Field Details

    • msg

      protected final MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg
      Drain of all generated messages.
    • filenamestem

      @Opt protected final @Opt String filenamestem
      The prefix of the names of the generated files. If ==null, no files are generated. It normally contains the name of the original tscore input file and that of the PART, if more than one.
    • outDir

      @Opt protected final @Opt File outDir
      Where to put the result files.
    • initialChunkSize

      protected final int initialChunkSize
    • expandingChunkSize

      protected final int expandingChunkSize
    • generationDate

      protected final String generationDate
      Calendaric date of generation, to be integrated into comment.FIXME
    • sourceIndication

      protected final String sourceIndication
      Comment text to identify the source of the data to a human reader
    • INTERNAL_SOURCE

      public static final String INTERNAL_SOURCE
      Comment text to indicate the absence of an external data source.
      See Also:
    • sig_text_header

      public static final String sig_text_header
      Initial comment for text file. Incorporates original source file name, voice name and calendaric date. ATTENTION, the original source file name MAY be related to a disk file, MAY include the name of the part (in case of a tscore multiple PART input), or MAY be completely synthetic.
      See Also:
    • sig_text_column_header

      public static final String sig_text_column_header
      Comment in the first line of the text file, containing the column headers.
      See Also:
    • sig_text_eof

      public static final String sig_text_eof
      Last line in the text file
      See Also:
    • score

      protected S extends Score_cwn score
      Running value: the Score_cwn of the voice currently translated.
    • voice_in_arrays

      @Opt protected @Opt Vox voice_in_arrays
      Fixed value: the tscore Vox reflected by the data arrays.
    • values_when

      @Opt protected @eu.bandm.tools.annotations.Opt float[] values_when
    • values_number

      @Opt protected @eu.bandm.tools.annotations.Opt int[] values_number
    • values_octaves

      @Opt protected @eu.bandm.tools.annotations.Opt byte[] values_octaves
    • values_fifths

      @Opt protected @eu.bandm.tools.annotations.Opt byte[] values_fifths
    • values_duration

      @Opt protected @eu.bandm.tools.annotations.Opt float[] values_duration
    • values_articulation

      @Opt protected @eu.bandm.tools.annotations.Opt byte[] values_articulation
    • msec_per_whole

      protected float msec_per_whole
      Gives the current tempo when the conversion process steps through the score.
    • measureNumber

      protected BigDecimal measureNumber
      The current mesaure number when the conversion process steps through the score.
    • eventNumber

      protected int eventNumber
      The current event number when the conversion process steps through the score. Is used to generate "trigger" information, thus defines "event identity". May possibly run modulo, i.e. step from {Integer#MAX_VALUE} to {Integer#MIN_VALUE}.
    • mm60

      public static Tempo mm60
      Default tempo 1/4=60
    • defaultInitialTempo

      Tempo defaultInitialTempo
      FIXME DOC
    • articulation2code

      protected static Map<Artikulation,Integer> articulation2code
    • currentRationalDuration

      Rational currentRationalDuration
      FIXME only for .._withComment :
  • Constructor Details

    • CwnToFloatSig_basic

      public CwnToFloatSig_basic(MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg, S score, @Opt @Opt String sourceIndication, @Opt @Opt String filenamestem, @Opt @Opt File outDir, int initialChunkSize, int expandingChunkSize)
      Convert semantic event-based CWN data into binary data to be played by a sig sequencer.
      Parameters:
      msg - drain of all messages
      sourceIndication - used in the text outout. If null, @{link #INTERNAL_SOURCE} will be used.
      filenamestem - the stem to generate the names of the output files If ==null, only array output will be done.
      outDir - where to generate the output files
      initialChunkSize - size for all arrays on creation. If ==0, only file output will be done
      expandingChunkSize - how to expand all arrays if necessary
    • CwnToFloatSig_basic

      public CwnToFloatSig_basic(CwnToFloatSig_basic<S> prototype)
      Constructor for converting several voices by copying all general parameters from the instance created first. (Esp. the creation message with its time stamp will appear identical for all voices!)
  • Method Details

    • newArrays

      protected void newArrays()
      Must be overriden by each subclass to construct the newly introduced arrays. That must call super.newArrays(). Is only called if initialChunkSize > 0.
    • initialTempo

      public Tempo initialTempo()
    • convert

      public void convert(Vox voice)
      Can be called from external (a) multiple times, if ONLY files are generated, or (b) only once, if data arrays are to be filled.
    • enlargeArrays

      protected void enlargeArrays()
    • closeArrays

      protected void closeArrays(int nextToWrite)
    • resizeArrays

      protected void resizeArrays(int newsize)
      Every subclass must override this method by code which adjusts its newly introduced data arrays accordingly. The code in every subclass must invoke super.resizeArrays(int);.
    • setMM

      protected void setMM(int mm)
      Set the tempo as the count of CWN "1/4" note durations per physical/calendaric minute.
    • setMM

      protected void setMM(Tempo tempo)
      Set the tempo.
    • note_duration_to_msec

      protected float note_duration_to_msec(RationalDuration.DottedBaseDuration db)
      Convert a CWN duration to msecs, according to the current tempo.
    • rat_to_msec

      protected float rat_to_msec(Rational duration)
      Convert a CWN duration to msecs, according to the current tempo.
    • extraColumns

      protected void extraColumns(@Opt @Opt PrintWriter txt, @Opt @Opt DataOutputStream dos, Event e, int trigger) throws IOException
      Hook method to extend this class to produce additional columns in the sequencer data. For each of these columns a data array must be provided. This method is called at the end processing every single event. If it is overridden, the code must start with super.extraColumns(), because the sequential order of writing to file is (naturally) significant.
      Throws:
      IOException
    • articulation2code

      protected static int articulation2code(Artikulation a)
    • writeEvent

      boolean writeEvent(Event e, float msec_start, @Opt @Opt Event next_e, float next_msec_start, int trigger, PrintWriter txt, DataOutputStream dos) throws IOException
      Write one event (sound or pause) to the array data and to the output files.. In case of sound, applies articulation factor to the duration and possibly writes TWO lines to the files, for the sound and the articulation pause. FIXME FEHLT INITIALE PAUSE !?!?!?
      Returns:
      whether one line has been added to the TDS
      Throws:
      IOException
    • dumpExtraColumns

      public void dumpExtraColumns(PrintStream out)
      Every subclass must override this method by code which adjusts its shows the newly introduced data arrays. The code in every subclass must invoke super.dumpExtraColumns(out).
    • dump

      public void dump(PrintStream out)
    • getValues_when

      @Opt public @eu.bandm.tools.annotations.Opt float[] getValues_when()
    • getValues_number

      @Opt public @eu.bandm.tools.annotations.Opt int[] getValues_number()
    • getValues_octaves

      @Opt public @eu.bandm.tools.annotations.Opt byte[] getValues_octaves()
    • getValues_fifths

      @Opt public @eu.bandm.tools.annotations.Opt byte[] getValues_fifths()
    • getValues_duration

      @Opt public @eu.bandm.tools.annotations.Opt float[] getValues_duration()
    • getValues_articulation

      @Opt public @eu.bandm.tools.annotations.Opt byte[] getValues_articulation()
    • main

      public static void main(String[] args)
      Test method, translates tscore input file "arg[0]", part wiht name "arg[1]" to sig output files in directory "arg[2]".