Class WavInterpolator

java.lang.Object
org.jamdev.jpamutils.wavFiles.WavInterpolator

public class WavInterpolator
extends Object
Decimates or interpolates sound files
Author:
Jamie Macaulay
  • Constructor Summary

    Constructors 
    Constructor Description
    WavInterpolator()
    Create a new WavInterpolator
  • Method Summary

    Modifier and Type Method Description
    double[] decimate​(double[] wavArray, float sR, float decimatorSr)
    Decimate wave data including anti alisaing filter.
    double[] getScaled​(double[] x, int l)
    Interpolate to create a new scaled vector of length l
    double[] interpolate​(double[] wavArray, float sR, float interpSr)
    Interpolate wave data either by decimating or up-sampling depending on the new sample rate.
    double[] upSample​(double[] wavArray, float sR, float interpSr)
    Up sample wave data.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • interpolate

      public double[] interpolate​(double[] wavArray, float sR, float interpSr)
      Interpolate wave data either by decimating or up-sampling depending on the new sample rate.
      Parameters:
      wavArray - - the wave data to interpolate.
      sR - - the sample rate of wavArray.
      interpSr - - the sample rate to interpolate to.
      Returns:
      the interpolated wave data.
    • upSample

      public double[] upSample​(double[] wavArray, float sR, float interpSr)
      Up sample wave data.
      Parameters:
      sR - - the current sample rate
      interpSr - - the samplerate to up-sample to in samples per second
      Returns:
      the up sampled data.
    • decimate

      public double[] decimate​(double[] wavArray, float sR, float decimatorSr)
      Decimate wave data including anti alisaing filter.
      Parameters:
      decimatorSr - - the new lower samnple rate
      Returns:
      the decimated data.
    • getScaled

      public double[] getScaled​(double[] x, int l)
      Interpolate to create a new scaled vector of length l
      Parameters:
      l - the desired vector length
      Returns:
      a new vector of length l created by interpolating x