Class LPCResult


  • public class LPCResult
    extends java.lang.Object
    Contains the result of linear predictive coding processing.
    • Constructor Summary

      Constructors 
      Constructor Description
      LPCResult()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void copyResiduals​(byte[] source, int targetPosition, int targetSize)
      Copies the information in the given unit to the array of residuals, starting at the given index, up until targetSize chars.
      void copyResidualsPulse​(byte[] source, int targetPosition, int targetSize)
      Copies the residual puse in the given unit to the array of residuals, starting at the given index, up until targetSize chars.
      void dump()
      Dumps this LPCResult to standard out
      void dump​(java.io.Writer writer)
      Dumps this LPCResult to the given stream.
      void dumpASCII()
      Dumps the wave data associated with this result
      void dumpASCII​(java.io.Writer writer)
      Dumps the wave out to the given stream
      void dumpASCII​(java.lang.String path)
      Dumps the wave data associated with this result
      short[] getFrame​(int index)
      Returns the frame at the given index.
      int getFrameShift​(int frameIndex)
      Returns the time difference of the frame at the given position with the frame prior to that.
      int getFrameSize()
      Returns the sizes of frames in this LPC.
      float getLPCMin()
      Returns the LPC minimum.
      float getLPCRange()
      Returns the LPC range.
      int getNumberOfChannels()
      Returns the number of channels in this LPCResult.
      int getNumberOfFrames()
      Returns the number of frames in this LPCResult.
      int getNumberOfSamples()
      Returns the number of samples in this LPC result
      byte[] getResiduals()
      Returns the array of residuals.
      int[] getResidualSizes()
      Returns the array of residuals sizes.
      int getSampleRate()
      Returns the sample rate.
      int[] getTimes()
      Returns the array of times.
      byte[] getWaveSamples()  
      boolean playWave​(AudioPlayer player, Utterance utterance)
      Synthesize a Wave from this LPCResult
      void resizeFrames​(int numberOfFrames)
      Resets the number of frames in this LPCResult.
      void resizeResiduals​(int numberOfSamples)
      Resets the number of residuals, and initialize all of them to 255 (which is 0 for mulaw).
      void setFrame​(int index, short[] newFrames)
      Sets the frame at the given index.
      void setFrameSize​(int frameSize)
      Sets the sizes of frames in this LPC to the given size.
      void setLPCMin​(float min)
      Sets the LPC minimum.
      void setLPCRange​(float range)
      Sets the LPC range.
      void setNumberOfChannels​(int numberOfChannels)
      Sets the number of channels.
      void setNumberOfFrames​(int numberFrames)
      Sets the number of frames in this LPC Result.
      void setResidualSizes​(int[] sizes)
      Sets the array of residual sizes.
      void setSampleRate​(int rate)
      Sets the sample rate.
      void setTimes​(int[] times)
      Sets the array of times.
      void setValues​(int numberOfChannels, int sampleRate, int residualFold, float lpcMin, float lpcRange)
      A convenience method for setting the LPC values.
      • Methods inherited from class java.lang.Object

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

      • LPCResult

        public LPCResult()
    • Method Detail

      • resizeFrames

        public void resizeFrames​(int numberOfFrames)
        Resets the number of frames in this LPCResult.
        Parameters:
        numberOfFrames - the number of frames in this LPC result
      • resizeResiduals

        public void resizeResiduals​(int numberOfSamples)
        Resets the number of residuals, and initialize all of them to 255 (which is 0 for mulaw).
        Parameters:
        numberOfSamples - the number of samples in this LPC result
      • setValues

        public void setValues​(int numberOfChannels,
                              int sampleRate,
                              int residualFold,
                              float lpcMin,
                              float lpcRange)
        A convenience method for setting the LPC values.
        Parameters:
        numberOfChannels - the number of channels
        sampleRate - the sample rate
        lpcMin - the LPC minimum
        lpcRange - the LPC range
      • getFrameShift

        public int getFrameShift​(int frameIndex)
        Returns the time difference of the frame at the given position with the frame prior to that. If the frame at the given position is the first frame (position 0), the time of that frame is returned.
        Parameters:
        frameIndex - the position of the frame
        Returns:
        the time difference of the frame at the given position with the frame prior to that
      • getFrameSize

        public int getFrameSize()
        Returns the sizes of frames in this LPC.
        Returns:
        the sizes of frames
      • getFrame

        public short[] getFrame​(int index)
        Returns the frame at the given index.
        Parameters:
        index - the index of interest
        Returns:
        the frame at the given index
      • getTimes

        public int[] getTimes()
        Returns the array of times.
        Returns:
        the array of times
      • getNumberOfFrames

        public int getNumberOfFrames()
        Returns the number of frames in this LPCResult.
        Returns:
        the number of frames
      • getNumberOfChannels

        public int getNumberOfChannels()
        Returns the number of channels in this LPCResult.
        Returns:
        the number of channels
      • getLPCMin

        public float getLPCMin()
        Returns the LPC minimum.
        Returns:
        the LPC minimum
      • getLPCRange

        public float getLPCRange()
        Returns the LPC range.
        Returns:
        the LPC range
      • getNumberOfSamples

        public int getNumberOfSamples()
        Returns the number of samples in this LPC result
        Returns:
        the number of samples
      • getSampleRate

        public int getSampleRate()
        Returns the sample rate.
        Returns:
        the sample rate
      • getResidualSizes

        public int[] getResidualSizes()
        Returns the array of residuals sizes.
        Returns:
        the array of residuals sizes
      • getResiduals

        public byte[] getResiduals()
        Returns the array of residuals.
        Returns:
        the array of residuals
      • setFrameSize

        public void setFrameSize​(int frameSize)
        Sets the sizes of frames in this LPC to the given size.
        Parameters:
        frameSize - the new frame size
      • setNumberOfFrames

        public void setNumberOfFrames​(int numberFrames)
        Sets the number of frames in this LPC Result.
        Parameters:
        numberFrames - the number of frames in this result
      • setFrame

        public void setFrame​(int index,
                             short[] newFrames)
        Sets the frame at the given index.
        Parameters:
        index - the position of the frame to set
        newFrames - new frame data
      • setTimes

        public void setTimes​(int[] times)
        Sets the array of times.
        Parameters:
        times - the times data
      • setNumberOfChannels

        public void setNumberOfChannels​(int numberOfChannels)
        Sets the number of channels.
        Parameters:
        numberOfChannels - the number of channels
      • setLPCMin

        public void setLPCMin​(float min)
        Sets the LPC minimum.
        Parameters:
        min - the LPC minimum
      • setLPCRange

        public void setLPCRange​(float range)
        Sets the LPC range.
        Parameters:
        range - the LPC range
      • setSampleRate

        public void setSampleRate​(int rate)
        Sets the sample rate.
        Parameters:
        rate - the sample rate
      • setResidualSizes

        public void setResidualSizes​(int[] sizes)
        Sets the array of residual sizes.
        Parameters:
        sizes - the new residual sizes
      • copyResiduals

        public void copyResiduals​(byte[] source,
                                  int targetPosition,
                                  int targetSize)
        Copies the information in the given unit to the array of residuals, starting at the given index, up until targetSize chars.
        Parameters:
        source - the unit that holds the information source
        targetPosition - start position in the array of residuals
        targetSize - the maximum number of characters to copy
      • copyResidualsPulse

        public void copyResidualsPulse​(byte[] source,
                                       int targetPosition,
                                       int targetSize)
        Copies the residual puse in the given unit to the array of residuals, starting at the given index, up until targetSize chars.
        Parameters:
        source - the unit that holds the information source
        targetPosition - start position in the array of residuals
        targetSize - the maximum number of characters to copy
      • playWave

        public boolean playWave​(AudioPlayer player,
                                Utterance utterance)
        Synthesize a Wave from this LPCResult
        Returns:
        the wave
      • getWaveSamples

        public byte[] getWaveSamples()
      • dump

        public void dump()
        Dumps this LPCResult to standard out
      • dump

        public void dump​(java.io.Writer writer)
        Dumps this LPCResult to the given stream.
        Parameters:
        writer - the output stream
      • dumpASCII

        public void dumpASCII()
        Dumps the wave data associated with this result
      • dumpASCII

        public void dumpASCII​(java.lang.String path)
                       throws java.io.IOException
        Dumps the wave data associated with this result
        Parameters:
        path - the path where the wave data is appended to
        Throws:
        java.io.IOException - if an IO error occurs
      • dumpASCII

        public void dumpASCII​(java.io.Writer writer)
        Dumps the wave out to the given stream
        Parameters:
        writer - the output stream