mean = utterance.getVoice().getPitch();
mean *= utterance.getVoice().getPitchShift();
stddev = utterance.getVoice().getPitchRange();
Relation target = utterance.createRelation(Relation.TARGET);
for (Item syllable =
utterance.getRelation(Relation.SYLLABLE).getHead();
syllable != null;
syllable = syllable.getNext()) {
if (syllable.getItemAs(Relation.SYLLABLE_STRUCTURE).hasDaughters()) {
tval = localF0Shift.findFeature(syllable);
localMean = Float.parseFloat(tval.toString());
if (localMean == 0.0) {
localMean = mean;
} else {
localMean *= mean;
}
tval = localF0Range.findFeature(syllable);
localStddev = Float.parseFloat(tval.toString());
if (localStddev == 0.0) {
localStddev = stddev;
}
Interceptor interceptor = applyLrModel(syllable);
if (isPostBreak(syllable)) {
lend = mapF0(interceptor.start, localMean, localStddev);
}
Float val = (Float) endPath.findFeature(syllable);
// assert val != null;
// don't mind null ptr exception
addTargetPoint(target, val.floatValue(),
mapF0((interceptor.start + lend) / 2.0f,
localMean, localStddev));
addTargetPoint(target, vowelMid(syllable),
mapF0(interceptor.mid, localMean, localStddev));
lend = mapF0(interceptor.end, localMean, localStddev);
if (isPreBreak(syllable)) {
Float eval = (Float) lastDaughterEndPath.findFeature(
syllable);
addTargetPoint(target, eval.floatValue(),
mapF0(interceptor.end, localMean, localStddev));
}
}
}
if (utterance.getRelation(Relation.SEGMENT).getHead() != null) {
Item first = target.getHead();
if (first == null) {
addTargetPoint(target, 0, mean);
} else if (first.getFeatures().getFloat("pos") > 0) {
Item newItem = first.prependItem(null);
newItem.getFeatures().setFloat("pos", 0.0f);
newItem.getFeatures().setFloat(
"f0", first.getFeatures().getFloat("f0"));
}
Item last = (Item) target.getTail();
Item lastSegment
= utterance.getRelation(Relation.SEGMENT).getTail();
float segEnd = 0.0f;
if (lastSegment != null) {