Package com.meapsoft

Examples of com.meapsoft.FeatChunk


        {
            double currTime = 0.0;
            Iterator i = templateChunks.iterator();
            while(i.hasNext())
            {
                FeatChunk currChunk = (FeatChunk)i.next();

                EDLChunk nc = new EDLChunk(
                    (FeatChunk)templateChunks.get(quantizeChunk(currChunk)),
                    currTime);
                outFile.chunks.add(nc);

                currTime += nc.length;
                progress.setValue(progress.getValue()+1);
            }

        }
        else  // quantize featsToQuantize
        {
            Iterator i = featsToQuantize.chunks.iterator();
            while(i.hasNext())
            {
                FeatChunk currChunk = (FeatChunk)i.next();
               
                EDLChunk nc = new EDLChunk(
                    (FeatChunk)templateChunks.get(quantizeChunk(currChunk)),
                    currChunk.startTime);
               
View Full Code Here


    //iterate through all the chunks that the segmenter found
    while(c.hasNext())
    {
      //your current features chunk
      FeatChunk ch = (FeatChunk)c.next();

      //make a new EDL chunk from the current features chunk
      EDLChunk original = new EDLChunk(ch, currTime);
      //we're going to make one more chunk for the backwards part
      EDLChunk backwards = new EDLChunk(ch, currTime+ch.length);
View Full Code Here

    double highBoundMult = highBound * 2;

    Vector featChunks = new Vector(featFile.chunks);

    // find chunks that fall in divisions or multiples of mode.
    FeatChunk tempFeatChunk;
    double tempFeatLen;
    Vector modeChunks = new Vector();
    Vector multModeChunks = new Vector();
    Vector divModeChunks = new Vector();
    Vector div2ModeChunks = new Vector();

    for (int i = 0; i < featChunks.size(); i++)
    {
      tempFeatChunk = (FeatChunk) featChunks.get(i);
      tempFeatLen = Math.floor(tempFeatChunk.length * samplingRate);

      if (lowBoundDiv2 < tempFeatLen && tempFeatLen < highBoundDiv2)
      {
        div2ModeChunks.add(featChunks.get(i));
        // System.out.println(" found a div2 in chunk" + i);
      }
      else if (lowBoundDiv < tempFeatLen && tempFeatLen < highBoundDiv)
      {
        divModeChunks.add(featChunks.get(i));
        // System.out.println(" found a div in chunk" + i);
      }
      else if (lowBoundMult < tempFeatLen && tempFeatLen < highBoundMult)
      {
        multModeChunks.add(featChunks.get(i));
        // System.out.println(" found a mult in chunk" + i);
      }
      else if (lowBound < tempFeatLen && tempFeatLen < highBound)
      {
        modeChunks.add(featChunks.get(i));
        // System.out.println(" found a mode in chunk" + i);
      }
    }

    Vector outChunks = new Vector();

    Random rand = new Random();
    int index;
    for (int i = 0; i < newPieceLength; i++)
    {
      index = rand.nextInt(16);
      if (0 <= index && index < 4)
      {
        if (div2ModeChunks.size() > 0)
        {
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          outChunks.add(div2ModeChunks.get(rand
              .nextInt(div2ModeChunks.size())));
          // System.out.println("Wrote 8 mode / 4 chunks");

        }
      }
      else if (4 <= index && index < 6)
      {
        if (divModeChunks.size() > 0)
        {
          outChunks.add(divModeChunks.get(rand.nextInt(divModeChunks
              .size())));
          outChunks.add(divModeChunks.get(rand.nextInt(divModeChunks
              .size())));
          outChunks.add(divModeChunks.get(rand.nextInt(divModeChunks
              .size())));
          outChunks.add(divModeChunks.get(rand.nextInt(divModeChunks
              .size())));
          // System.out.println("Wrote 4 mode / 2 chunks");
        }
      }
      else if (6 <= index && index < 14)
      {
        if (modeChunks.size() > 0)
        {
          outChunks.add(modeChunks.get(rand
              .nextInt(modeChunks.size())));
          outChunks.add(modeChunks.get(rand
              .nextInt(modeChunks.size())));
          // System.out.println("Wrote 2 mode chunks");
        }
      }
      else if (14 <= index)
      {
        if (multModeChunks.size() > 0)
        {
          outChunks.add(multModeChunks.get(rand
              .nextInt(multModeChunks.size())));
          // System.out.println("Wrote 1 mode * 2 chunk");
        }
      }

      progress.setValue(progress.getValue() + 1);
    }

    double currTime = 0;
    while (outChunks.size() > 0)
    {
      FeatChunk match = (FeatChunk) outChunks.remove(0);

      // turn match chunk into an EDL chunk
      EDLChunk nc = new EDLChunk(match, currTime);

      if (debug)
      {
        NumberFormat fmt = NumberFormat.getInstance();
        fmt.setMaximumFractionDigits(3);
        nc.comment = "    # feats = ";
        double[] feat = match.getFeatures();
        for (int x = 0; x < feat.length - 1; x++)
          nc.comment += fmt.format(feat[x]) + ", ";
        nc.comment += fmt.format(feat[feat.length - 1]);
      }

View Full Code Here

    Iterator c = featFile.chunks.iterator();
    double currTime = 0;
       
    while(c.hasNext())
    {
      FeatChunk ch = (FeatChunk)c.next();

      EDLChunk nc = new EDLChunk(ch, currTime);
      // hard-coded parameters of blip
      EDLChunk blip = new EDLChunk(blipWav, 0, 0.1, currTime);
View Full Code Here

      }
    }
    else
      maxdim = ((FeatChunk) featFile.chunks.get(0)).numFeatures();

    FeatChunk targetChunk = new FeatChunk("", 0, 0, null);
    for (int i = 0; i <= maxdim; i++)
      // targetChunk.addFeature(0);
      targetChunk.addFeature(Integer.MIN_VALUE);

    dist.setTarget(targetChunk);

    // maintain a set of chunks sorted using dist from targetChunk
    TreeSet chunks = null;
    if (reverseSort)
            chunks = new TreeSet(Collections.reverseOrder(dist));
        else
            chunks = new TreeSet(dist);
    chunks.addAll(featFile.chunks);

        //System.out.println(chunks);

    NumberFormat fmt = NumberFormat.getInstance();
    fmt.setMaximumFractionDigits(3);

    double currTime = 0;
    while (chunks.size() > 0)
    {
      FeatChunk match = (FeatChunk) chunks.first();
            chunks.remove(match);

      // turn match chunk into an EDL chunk
      EDLChunk nc = new EDLChunk(match, currTime);

            if (debug)
      {
        nc.comment = "    # feats = ";
        double[] feat = match.getFeatures(featdim);
        for (int x = 0; x < feat.length - 1; x++)
          nc.comment += fmt.format(feat[x]) + ", ";
        nc.comment += fmt.format(feat[feat.length - 1]);
      }
View Full Code Here

   
    //System.out.println("localStartBeat: " + localStartBeat);
   
    for (int measure = 0; measure < totalChunks/beatsPerMeasure; measure++)
    {
      FeatChunk chunks[] = new FeatChunk[beatsPerMeasure];
      int numBeatsFound = 0;
     
      for (int i = 0; i < beatsPerMeasure; i++)
        chunks[i] = (FeatChunk)c.next();
View Full Code Here

    int ndat = trainFile.chunks.size();
    int prevState = -1;
    String lastSrcFile = "";
    for (int n = 0; n < ndat; n++)
    {
      FeatChunk ch = (FeatChunk) trainFile.chunks.get(n);

      int currState = quantizeChunk(ch);

      // is this the beginning of a srcFile?
      if (!lastSrcFile.equals(ch.srcFile))
View Full Code Here

   
    //iterate through all the chunks that the segmenter found
    while(c.hasNext())
    {
      //your current features chunk
      FeatChunk ch = (FeatChunk)c.next();
     
      double[] feats = ch.getFeatures();
     
      //System.out.println("feature[0]: " + feats[0]);
      //System.out.println("insideThreshold: " +  insideThreshold + " thresholdBottom: " + thresholdBottom +
      //  " thresholdTop: " + thresholdTop);
     
View Full Code Here

    // iterate through all the chunks that the segmenter found
    while (c.hasNext())
    {
      // your current features chunk
      FeatChunk ch = (FeatChunk) c.next();
      double length = ch.length / numSubChunks;
      double localStartTime = ch.startTime;

      for (int i = numSubChunks - 1; i >= 0; i--)
      {
View Full Code Here

    fmt.setMaximumFractionDigits(3);

    Iterator dstchunks = dstFile.chunks.iterator();
    while (dstchunks.hasNext())
    {
      FeatChunk currChunk = (FeatChunk) dstchunks.next();
      double mindist = Double.MAX_VALUE;
      FeatChunk match = null;

      // find closest match to currChunk in DB
      Iterator i = DBFile.chunks.iterator();
      while (i.hasNext())
      {
        FeatChunk c = (FeatChunk) i.next();
        double d = dist.distance(currChunk, c);

        if (d < mindist)
        {
          mindist = d;
View Full Code Here

TOP

Related Classes of com.meapsoft.FeatChunk

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.