tps
/*GLO OUT subs, GLO IN ..*/){
if (timeChanged)
lilypondGenerator.putS(" \\time 4/4");
lilypondGenerator.putF("%% %d", i);
lilypondGenerator.putS(" |");
final Integer rel_pitch = seq_pitch.get(i);
final String text_pitch = relwert_2_pitch(rel_pitch);
final Integer rel_intens = seq_intensity.get(i);
lilypondGenerator.startGraphEvent(Rational.ONE);
// das breathe wird VOR die Note gesetzt, genau wie oben:
String event = checkForThBreath("", rel_pitch, rel_intens);
event += text_pitch+"1\\fermata" ;
final Tp now = tps.get(i);
if (tp2barnum.containsKey(now))
event+="^\\markup{\\small{("+tp2barnum.get(now)+")}}";
event = change_intensity (event, rel_intens);
if (rel_pitch==indexMax)
event = "\\triHead " + event +" \\triHoff ";
lilypondGenerator.putF(event);
wasPause = false ;
}//put_long_event
/** Generate a fermata-measure for longest possible pause.*/
protected void put_long_pause(/*GLO OUT subs, GLO IN ..*/){
if (timeChanged)
lilypondGenerator.putS(" \\time 4/4");
lilypondGenerator.putS("R1\\fermata \bar\"||\" ");
wasPause = true ;
}//put_long_event
/** Convert the RelWert of the K-Voices into a list of array index values.
* By {@link RelWert#getArrayIndex()}.
*
* exp1!=null eep2!= null => add them
* exp1!=null eep2== null => put only voice 1
* exp1==null eep2!= null => put only voice 2 and emit warning
* exp1==null eep2== null => put sequence of "M" values
*
* The same voice(-name) can be given twice, what means a doubling of the
* voice's V-effects.
*/
protected void addValues (final @Opt List exp1,
final @Opt List exp2,
final int len,
final String p,
final /*out*/ List out){
if (exp1!=null)
if (exp2==null)
for (int i = 0; i(limit);
seq_duration = new ArrayList(limit);
seq_intensity = new ArrayList(limit);
addValues(exp.expanded.get(v_dt0), exp.expanded.get(v_dt1), limit, "dt", seq_duration);
addValues(exp.expanded.get(v_th0), exp.expanded.get(v_th1), limit, "th", seq_pitch);
addValues(exp.expanded.get(v_ls0), exp.expanded.get(v_ls1), limit, "ls", seq_intensity);
lilypondGenerator.open(inputFileName, outputFileStem, subtitle);
lilypondGenerator.putText(specialPreamble);
lilypondGenerator.open_score();
lilypondGenerator.open_staffGroup();
// =====================================
writeToFormat (exp, v_ps /*, glo seq_duration...*/);
// =====================================
lilypondGenerator.putSpace();
// =====================================
writeVoiceGraphics (exp, "dura", v_dt0);
if (v_dt0!=v_dt1)
writeVoiceGraphics (exp, "dura", v_dt1);
writeVoiceGraphics (exp, "tonh", v_th0);
if (v_th0!=v_th1)
writeVoiceGraphics (exp, "tonh", v_th1);
writeVoiceGraphics (exp, "laut", v_ls0);
if (v_ls0!=v_ls1)
writeVoiceGraphics (exp, "laut", v_ls1);
// =====================================
lilypondGenerator.close_staffGroup();
lilypondGenerator.close_score();
}
protected void writeVoiceGraphics (final Expansion exp,
final String title, final @Opt Vox v){
if (v==null)
return ;
lilypondGenerator.writeGraphics(title, v, exp.expanded.get(v), exp.tps,
event2relwert, event2haken, event2doppelHaken);
}
// ---------------------------------------------------------------------
/** Main method, translates input file in HKN-vox format to lilypond output file.
* @param args[0] input file name
* @param args[1] basic score name (also determines the output files)
* @param args[2] used for the entry catgory "subtitle" in the header of the
* generated lilypond source. "-" stands for "none",
* (The category "title" will be filled by the name of the outputfile,
* "subsubtitle" will be a source file indication.)
* @param args[3] pause voice ("-" stands for "none")
* @param Args[4]/[5] give the two voices for "Dauer" ("duration")
* @param args[6]/[7] give the two voices for "Tonhoehe" ("pitch")
* @param args[8]/[9] give the two voices for "Lautstärke" ("volume"/"intensity")
*/
public static void main (String[] args) {
final MessageCounter mcnt = new MessageCounter();
final MessageReceiver> msg
= new MessageTee<>(new MessageFormatter<>(new MessagePrinter<>()),
mcnt);
if (args.length<6)
msg.receive(SimpleMessage.error("not enough command line parameters."));
mcnt.terminateApplicationOnErrors();
String message = null ;
final String inputfilename = (args[0]);
msg.receive(SimpleMessage.logStart("parsing input file %s to raw data", inputfilename));
final File inputfile = new File(inputfilename) ;
final TimeScape ts = Util.parseTimeScape(inputfile, modifiers, msg);
msg.receive(SimpleMessage.logEnd("parsing input file"));
mcnt.terminateApplicationOnErrors();
// ====================================================================
// convert raw model into Score_haken semantic interpretation
// ====================================================================
msg.receive(SimpleMessage.logStart(message="semantic interpretation"));
final String scoreNameStem = args[1];
final Map scores
= fromTimeScape(ts,scoreNameStem,msg,null);
String subtitle = args[2];
if (noVoiceSelected.equals(subtitle))
subtitle = null ;
for (final Score_hkn_vla_v00 score : scores.values()){
final Vox vps = score.findVoice (args[3], true/*=errorNotWarning on spelling error.*/);
// from here different from "vox":
final @Opt Vox vdt0 = score.findVoice (args[4], true);
final @Opt Vox vdt1 = score.findVoice (args[5], true);
final @Opt Vox vth0 = score.findVoice (args[6], true);
final @Opt Vox vth1 = score.findVoice (args[7], true);
final @Opt Vox vls0 = score.findVoice (args[8], true);
final @Opt Vox vls1 = score.findVoice (args[9], true);
mcnt.terminateApplicationOnErrors();
// ======================================================
score.update(inputfilename, score.name, subtitle, vps,
vdt0, vdt1, vth0, vth1, vls0, vls1);
// ======================================================
msg.receive(SimpleMessage.logEnd(message));
// ====================================================================
// write lilypond format objects to output file
// ====================================================================
final String outputfilename = score.name+".ly";
score.lilypondGenerator.writeToFile(outputfilename);
msg.receive(SimpleMessage.log("result written to %s", outputfilename));
}//for scores
}//main
}