Package eu.bandm.music.top
Class CwnToDoubleSig_basic<S extends Score_cwn>
java.lang.Object
eu.bandm.music.top.CwnToDoubleSig_basic<S>
- Direct Known Subclasses:
CwnToDoubleSig_withComment
,CwnToDoubleSig_withOrnament
Creates as output a basic sig sequencer data to be put into a
CwnSequencerDouble
, 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:
- Double start time point ("onset")
- int event number: its changes are trigger information for the envelope
- byte octaves coordinate (relative to c'/C4))
- byte fifths coordinate (relative to c'/C4))
- PRE20230218 byte octave register (midi style)
- PRE20230218 byte stammton
- PRE20230218 byte versetzung (signed)
- PRE20230218 byte fifth Euler coordinate
- PRE20230218 byte third Euler coordinate
- Double duration
- byte volume ?????
- byte articulation (0=legato, incr=shorter)
tscore:TimeScape Part ----> ScoreCwn ---+ ---> OR --> CwnToDoubleSig_:basic Vox | | CwnToSig_basic --> Disk Files Vox +-----------| CwnTo Sig_basic --> Disk Files Part Vox Vox
-
Field Summary
Modifier and TypeFieldDescriptionprotected static Map<Artikulation,
Integer> (package private) Rational
FIXME only for .._withComment :(package private) Tempo
FIXME DOCprotected int
The current event number when the conversion process steps through the score.protected final int
The prefix of the names of the generated files.protected final String
Calendaric date of generation, to be integrated into comment.FIXMEprotected final int
static final String
Comment text to indicate the absence of an external data source.protected BigDecimal
The current mesaure number when the conversion process steps through the score.static Tempo
Default tempo 1/4=60protected float
Gives the current tempo when the conversion process steps through the score.protected final MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>>
Drain of all generated messages.Where to put the result files.protected S
Running value: theScore_cwn
of the voice currently translated.static final String
Comment in the first line of the text file, containing the column headers.static final String
Last line in the text filestatic final String
Initial comment for text file.protected final String
Comment text to identify the source of the data to a human readerprotected @eu.bandm.tools.annotations.Opt byte[]
protected @eu.bandm.tools.annotations.Opt double[]
protected @eu.bandm.tools.annotations.Opt byte[]
protected @eu.bandm.tools.annotations.Opt int[]
protected @eu.bandm.tools.annotations.Opt byte[]
protected @eu.bandm.tools.annotations.Opt double[]
Fixed value: the tscoreVox
reflected by the data arrays. -
Constructor Summary
ConstructorDescriptionCwnToDoubleSig_basic
(CwnToDoubleSig_basic<S> prototype) Constructor for converting several voices by copying all general parameters from the instance created first.CwnToDoubleSig_basic
(MessageReceiver<SimpleMessage<eu.bandm.tools.util.xml.XMLDocumentIdentifier>> msg, S score, @Opt String sourceIndication, @Opt String filenamestem, @Opt File outDir, int initialChunkSize, int expandingChunkSize) Convert semantic event-based CWN data into binary data to be played by a sig sequencer. -
Method Summary
Modifier and TypeMethodDescriptionprotected static int
protected void
closeArrays
(int nextToWrite) void
Can be called from external (a) multiple times, if ONLY files are generated, or (b) only once, if data arrays are to be filled.void
dump
(PrintStream out) void
Every subclass must override this method by code which adjusts its shows the newly introduced data arrays.protected void
protected void
extraColumns
(@Opt PrintWriter txt, @Opt DataOutputStream dos, Event e, int trigger) Hook method to extend this class to produce additional columns in the sequencer data.@eu.bandm.tools.annotations.Opt byte[]
@eu.bandm.tools.annotations.Opt double[]
@eu.bandm.tools.annotations.Opt byte[]
@eu.bandm.tools.annotations.Opt int[]
@eu.bandm.tools.annotations.Opt byte[]
@eu.bandm.tools.annotations.Opt double[]
static void
Test method, translates tscore input file "arg[0]", part wiht name "arg[1]" to sig output files in directory "arg[2]".protected void
Must be overriden by each subclass to construct the newly introduced arrays.protected float
Convert a CWN duration to msecs, according to the current tempo.protected float
rat_to_msec
(Rational duration) Convert a CWN duration to msecs, according to the current tempo.protected void
resizeArrays
(int newsize) Every subclass must override this method by code which adjusts its newly introduced data arrays accordingly.protected void
setMM
(int mm) Set the tempo as the count of CWN "1/4" note durations per physical/calendaric minute.protected void
Set the tempo.(package private) boolean
writeEvent
(Event e, float msec_start, @Opt Event next_e, float next_msec_start, int trigger, PrintWriter txt, DataOutputStream dos) Write one event (sound or pause) to the array data and to the output files..
-
Field Details
-
msg
Drain of all generated messages. -
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
Where to put the result files. -
initialChunkSize
protected final int initialChunkSize -
expandingChunkSize
protected final int expandingChunkSize -
generationDate
Calendaric date of generation, to be integrated into comment.FIXME -
sourceIndication
Comment text to identify the source of the data to a human reader -
INTERNAL_SOURCE
Comment text to indicate the absence of an external data source.- See Also:
-
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
Comment in the first line of the text file, containing the column headers.- See Also:
-
sig_text_eof
Last line in the text file- See Also:
-
score
Running value: theScore_cwn
of the voice currently translated. -
voice_in_arrays
Fixed value: the tscoreVox
reflected by the data arrays. -
values_when
-
values_number
-
values_octaves
-
values_fifths
-
values_duration
-
values_articulation
-
msec_per_whole
protected float msec_per_wholeGives the current tempo when the conversion process steps through the score. -
measureNumber
The current mesaure number when the conversion process steps through the score. -
eventNumber
protected int eventNumberThe 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
Default tempo 1/4=60 -
defaultInitialTempo
Tempo defaultInitialTempoFIXME DOC -
articulation2code
-
currentRationalDuration
Rational currentRationalDurationFIXME only for .._withComment :
-
-
Constructor Details
-
CwnToDoubleSig_basic
public CwnToDoubleSig_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 messagessourceIndication
- 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 filesinitialChunkSize
- size for all arrays on creation. If ==0, only file output will be doneexpandingChunkSize
- how to expand all arrays if necessary
-
CwnToDoubleSig_basic
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 callsuper.newArrays()
. Is only called ifinitialChunkSize
> 0. -
initialTempo
-
convert
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 invokesuper.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
Set the tempo. -
note_duration_to_msec
Convert a CWN duration to msecs, according to the current tempo. -
rat_to_msec
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 withsuper.extraColumns()
, because the sequential order of writing to file is (naturally) significant.- Throws:
IOException
-
articulation2code
-
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
Every subclass must override this method by code which adjusts its shows the newly introduced data arrays. The code in every subclass must invokesuper.dumpExtraColumns(out)
. -
dump
-
getValues_when
-
getValues_number
-
getValues_octaves
-
getValues_fifths
-
getValues_duration
-
getValues_articulation
-
main
Test method, translates tscore input file "arg[0]", part wiht name "arg[1]" to sig output files in directory "arg[2]".
-