Package com.meapsoft

Examples of com.meapsoft.RingMatrix


    double[] curFrame;
    double sum = 0;

    // we're expecting a certain frequency resolution...
    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if (recalculateSTFT)
    {
      // keep the same number of frames as in stft
      newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame
          + length), (N - 1) * 2, stft.nhop);
      length = newstft.getColumns();
    }

    // intialize average to 0
    Arrays.fill(linSpec, 0);

    // System.out.println("startFrame: " + startFrame + " length: " +
    // length);
    // collect average linear spectrum
    for (int frame = 0; frame < length; frame++)
    {
      if (!recalculateSTFT)
        curFrame = stft.getFrame(startFrame + frame);
      else
        curFrame = newstft.getColumn(frame);

      // what's going on? For very sparse segments curFrame is sometimes
      // null???
      // is there a zero length segment or something?
      if (curFrame != null)
View Full Code Here


    double[] freq = new double[1];
    double[] curFrame;

    boolean recalculateSTFT = stft.getRows() != N;
   
    RingMatrix newstft = null;
    if (recalculateSTFT)
    {
      if (preEmphasis)
      {
        double[] origSamples = stft.getSamples(startFrame, startFrame + length);
        double[] preEmphSamples = com.meapsoft.DSP.preEmphasis(origSamples);
        newstft = STFT.getSTFT(preEmphSamples, (N - 1) * 2, stft.nhop);
        length = newstft.getColumns();
      }
      else
      {
        // keep the same number of frames as in stft
        newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame
            + length), (N - 1) * 2, stft.nhop);
        length = newstft.getColumns();
      }
    }
   

    // if there are no features we just bail.
    if (length == 0)
      return null;

    //double wtdsum = 0;
    // double sumwts = 0;

    // collect average linear spectrum
    Arrays.fill(linSpec, 0);
    for (int frame = 0; frame < length; frame++)
    {

      if (!recalculateSTFT)
        curFrame = stft.getFrame(startFrame + frame);
      else
        curFrame = newstft.getColumn(frame);

      if (curFrame != null)
      {
        for (int band = 0; band < linSpec.length; band++)
          linSpec[band] += Math.pow(10, curFrame[band] / 10) / length;
View Full Code Here

    double sum = 0;
    double sum2 = 0;
    double[] pitch = new double[1];

    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if (recalculateSTFT)
    {
      // keep the same number of frames as in stft
      newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame
          + length), (N - 1) * 2, stft.nhop);
      length = newstft.getColumns();
    }


    // Apply mapping to each frame, keep histogram of results
    int[] pitchcounts = new int[nOpBins];
    Arrays.fill(pitchcounts, 0);
    for (int frame = 0; frame < length; frame++) {
      if (!recalculateSTFT)
        curFrame = stft.getFrame(startFrame + frame);
      else
        curFrame = newstft.getColumn(frame);

      if (curFrame != null) {
        for (int band = 0; band < linSpec.length; band++) {
          linSpec[band] = Math.pow(10, curFrame[band] / 20);
          //System.out.print(linSpec[band] + " ");
View Full Code Here

    double[] curFrame;
    double sum = 0;
    double sum2 = 0;

    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if (recalculateSTFT)
    {
      // keep the same number of frames as in stft
      newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame
          + length), (N - 1) * 2, stft.nhop);
      length = newstft.getColumns();
    }

    // intialize average to 0
    Arrays.fill(linSpec, 0);

    // collect average linear spectrum
    for (int frame = 0; frame < length; frame++)
    {

      if (!recalculateSTFT)
        curFrame = stft.getFrame(startFrame + frame);
      else
        curFrame = newstft.getColumn(frame);

      if (curFrame != null)
        for (int band = 0; band < linSpec.length; band++)
          linSpec[band] += Math.pow(10, curFrame[band] / 10) / length;
    }
View Full Code Here

  public double[] features(STFT stft, long startFrame, int length) {
    double[] freq = new double[1];
    double[] curFrame;

    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if(recalculateSTFT) {
        // keep the same number of frames as in stft
        newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame+length), (N-1)*2, stft.nhop);
        length = newstft.getColumns();
    }   
   
  //if there are no features we just bail.
  if (length == 0
    return null;

    double wtdsum = 0;
    double sumwts = 0;

    // collect average linear spectrum
    Arrays.fill(linSpec, 0);
    for(int frame=0; frame<length; frame++) {

        if(!recalculateSTFT)
            curFrame = stft.getFrame(startFrame+frame);
        else
            curFrame = newstft.getColumn(frame);

        if(curFrame != null) {
            for(int band=0; band<linSpec.length; band++)
    linSpec[band] += Math.pow(10,curFrame[band]/10) / length;
  }
View Full Code Here

  {
    double[] pitch = new double[1];
    double[] curFrame;

    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if (recalculateSTFT)
    {
      // keep the same number of frames as in stft
      newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame
          + length), (N - 1) * 2, stft.nhop);
      length = newstft.getColumns();
    }

    // if there are no features we just bail.
    if (length == 0)
      return null;

    double wtdsum = 0;
    double sumwts = 0;

    // collect average linear spectrum
    Arrays.fill(linSpec, 0);
    for (int frame = 0; frame < length; frame++)
    {

      if (!recalculateSTFT)
        curFrame = stft.getFrame(startFrame + frame);
      else
        curFrame = newstft.getColumn(frame);

      if (curFrame != null)
      {
        for (int band = 0; band < linSpec.length; band++)
          linSpec[band] += Math.pow(10, curFrame[band] / 10) / length;
View Full Code Here

    double[] curFrame;
    double sum = 0;
    double sum2 = 0;

    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if(recalculateSTFT)
    {
        // keep the same number of frames as in stft
        newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame+length), (N-1)*2, stft.nhop);
        length = newstft.getColumns();
    }   

    // intialize average to 0
    Arrays.fill(linSpec, 0);

    // collect average linear spectrum
    for(int frame=0; frame<length; frame++) {

        if(!recalculateSTFT)
            curFrame = stft.getFrame(startFrame+frame);
        else
            curFrame = newstft.getColumn(frame);

        if(curFrame != null)
            for(int band=0; band<linSpec.length; band++)
                linSpec[band] += Math.pow(10,curFrame[band]/10) / length;
    }
View Full Code Here

    double[] curFrame;
    double sum = 0;

    // we're expecting a certain frequency resolution...
    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if(recalculateSTFT) {
        // keep the same number of frames as in stft
        newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame+length), (N-1)*2, stft.nhop);
        length = newstft.getColumns();
    }   

    // intialize average to 0
    Arrays.fill(linSpec, 0);

    // collect average linear spectrum
    for(int frame=0; frame<length; frame++) {
        if(!recalculateSTFT)
            curFrame = stft.getFrame(startFrame+frame);
        else
            curFrame = newstft.getColumn(frame);

        for(int band=0; band<linSpec.length; band++)
            linSpec[band] += curFrame[band] / length;
    }
   
View Full Code Here

  public double[] features(STFT stft, long startFrame, int length) {
    double[] pitch = new double[1];
    double[] curFrame;

    boolean recalculateSTFT = stft.getRows() != N;
    RingMatrix newstft = null;
    if(recalculateSTFT) {
        // keep the same number of frames as in stft
        newstft = STFT.getSTFT(stft.getSamples(startFrame, startFrame+length), (N-1)*2, stft.nhop);
        length = newstft.getColumns();
    }   

  //if there are no features we just bail.
  if (length == 0
    return null;
 
    double wtdsum = 0;
    double sumwts = 0;

    // collect average linear spectrum
    Arrays.fill(linSpec, 0);
    for(int frame=0; frame<length; frame++) {

        if(!recalculateSTFT)
            curFrame = stft.getFrame(startFrame+frame);
        else
            curFrame = newstft.getColumn(frame);

        if(curFrame != null) {
            for(int band=0; band<linSpec.length; band++)
    linSpec[band] += Math.pow(10,curFrame[band]/10) / length;
  }
View Full Code Here

TOP

Related Classes of com.meapsoft.RingMatrix

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.