Package com.sun.speech.freetts.relp

Examples of com.sun.speech.freetts.relp.SampleSet


     *
     * @return the nearest Sample
     */
    public Sample getNearestSample(float index) {
  int i, iSize = 0, nSize;
  SampleSet sts = db.getSts();

  // loop through all the Samples in this unit
  for (i = start; i < end; i++) {
      Sample sample = sts.getSample(i);
      nSize = iSize + sample.getResidualSize();

      if (Math.abs(index - (float) iSize) <
    Math.abs(index - (float) nSize)) {
    return sample;
      }
      iSize = nSize;
  }
  return sts.getSample(end - 1);
    }
View Full Code Here


    joinWeightShift = calcJoinWeightShift(joinWeights);

      } else if (tag.equals("STS")) {
    String name = tokenizer.nextToken();
    if (name.equals("STS")) {
        sts = new SampleSet(tokenizer, reader);
    } else {
        mcep = new SampleSet(tokenizer, reader);
    }
      } else if (tag.equals("UNITS")) {
    int type = Integer.parseInt(tokenizer.nextToken());
    int phone = Integer.parseInt(tokenizer.nextToken());
    int start = Integer.parseInt(tokenizer.nextToken());
View Full Code Here

  int unitTypesLength = bb.getInt();
  unitTypes = new UnitType[unitTypesLength];
  for (int i = 0; i < unitTypes.length; i++) {
      unitTypes[i] = new UnitType(bb);
  }
  sts = new SampleSet(bb);
  mcep = new SampleSet(bb);

  int numCarts = bb.getInt();
  cartMap = new HashMap();
  for (int i = 0; i < numCarts; i++) {
      String name = Utilities.getString(bb);
View Full Code Here

  int unitTypesLength = is.readInt();
  unitTypes = new UnitType[unitTypesLength];
  for (int i = 0; i < unitTypes.length; i++) {
      unitTypes[i] = new UnitType(is);
  }
  sts = new SampleSet(is);
  mcep = new SampleSet(is);

  int numCarts = is.readInt();
  cartMap = new HashMap();
  for (int i = 0; i < numCarts; i++) {
      String name = Utilities.getString(is);
View Full Code Here

  int uttSize = 0;
  int unitEntry;
  int unitStart;
  int unitEnd;

  SampleSet sts = (SampleSet) utterance.getObject("sts_list");
  lpcResult = new LPCResult();

  for (Item unit = utterance.getRelation(Relation.UNIT).getHead();
    unit != null; unit = unit.getNext()) {
      unitEntry = unit.getFeatures().getInt("unit_entry");
      unitStart = unit.getFeatures().getInt("unit_start");
      unitEnd = unit.getFeatures().getInt("unit_end");
      uttSize += sts.getUnitSize(unitStart, unitEnd);
      pitchmarks += unitEnd - unitStart;
      unit.getFeatures().setInt("target_end", uttSize);
  }

  lpcResult.resizeFrames(pitchmarks);

  pitchmarks = 0;
  uttSize = 0;

  int[] targetTimes = lpcResult.getTimes();

  for (Item unit = utterance.getRelation(Relation.UNIT).getHead();
    unit != null; unit = unit.getNext()) {
      unitEntry = unit.getFeatures().getInt("unit_entry");
      unitStart = unit.getFeatures().getInt("unit_start");
      unitEnd = unit.getFeatures().getInt("unit_end");
      for (int i = unitStart; i < unitEnd; i++,pitchmarks++) {
    uttSize += sts.getSample(i).getResidualSize();
    targetTimes[pitchmarks] = uttSize;
      }
  }
  utterance.setObject("target_lpcres", lpcResult);
    }
View Full Code Here

TOP

Related Classes of com.sun.speech.freetts.relp.SampleSet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.