Class AudioFrameProcessor

  • Direct Known Subclasses:
    AudioBufferProcessor, PeakDetector

    public class AudioFrameProcessor
    extends AudioSampleProcessor
    Calculates amplitude values for an audio frame. An audio frame contains the samples for all channels.
    Author:
    K.Jaensch, klausj@phonetik.uni-muenchen.de
    • Method Detail

      • getFloatValues

        public float[] getFloatValues​(byte[] frameData)
        Returns the normalized float values (amplitudes) of the given frame.
        Parameters:
        frameData - PCM coded data array
        Returns:
        values (range -0.5 ... +0.5)
      • getFloatValues

        public float[] getFloatValues​(byte[] frameData,
                                      int offset)
        Returns the normalized float values (amplitudes) of the given data.
        Parameters:
        frameData - PCM coded data array
        offset - offset in the data
        Returns:
        values (range -0.5 ... +0.5)
      • getNormalizedInterleavedValues

        public void getNormalizedInterleavedValues​(byte[] frameData,
                                                   int frames,
                                                   double[][] normBuffer,
                                                   int normBufferFrameOffset)
        Converts PCM coded data to normalized double values (amplitudes).
        Parameters:
        frameData - PCM coded data array
        frames - count of frames to process
        normBuffer - buffer for normalized audio data (value range -1.0 ... +1.0)
        normBufferFrameOffset - offset in frames from where to write converted values
      • getNormalizedInterleavedValues

        public void getNormalizedInterleavedValues​(byte[] frameData,
                                                   int frameDataOffset,
                                                   int frames,
                                                   double[][] normBuffer,
                                                   int normBufferFrameOffset)
        Converts PCM coded data to normalized double values (amplitudes).
        Parameters:
        frameData - PCM coded data array
        frameDataOffset - offset in frameData
        frames - count of frames to process
        normBuffer - buffer for normalized audio data (value range -1.0 ... +1.0)
        normBufferFrameOffset - offset in frames from where to write converted values
      • getNormalizedValues

        public void getNormalizedValues​(byte[] frameData,
                                        int offset,
                                        double[] normBuffer)
        Converts to normalized float values (amplitudes) of the given data.
        Parameters:
        frameData - PCM coded data array
        offset - offset (of bytes) in PCM input data
        normBuffer - buffer for normalized audio data (value range -1.0 ... +1.0)
      • getDoubleValues

        public void getDoubleValues​(byte[] frameData,
                                    int offset,
                                    double[] buffer)
        Converts to normalized double values (amplitudes) of the given data.
        Parameters:
        frameData - PCM coded data array
        offset - offset (of bytes) in PCM input data
        buffer - buffer for audio data values (range -0.5 ... +0.5)
      • getFloatValues

        public void getFloatValues​(byte[] frameData,
                                   int offset,
                                   float[] buffer)
        Converts to normalized float values (amplitudes) of the given data.
        Parameters:
        frameData - PCM coded data array
        offset - offset (of bytes) in PCM input data
        buffer - buffer for audio data values (range -0.5 ... +0.5)
      • encodeToFloatValues

        public void encodeToFloatValues​(float[] values,
                                        byte[] buf,
                                        int offset)
        Encode one frame of normalized float values to byte buffer.
        Parameters:
        values - float values for all channels
        buf - the buffer
        offset - bufPos in the buffer
      • encodeValues

        public void encodeValues​(float[] values,
                                 byte[] buf,
                                 int offset)
        Encode one frame of normalized float values to byte buffer.
        Parameters:
        values - float values for all channels
        buf - the buffer
        offset - bufPos in the buffer
      • encodeValues

        public void encodeValues​(double[] values,
                                 byte[] buf,
                                 int offset)
        Encode one frame of normalized double values to byte buffer.
        Parameters:
        values - double values for all channels
        buf - the buffer
        offset - bufPos in the buffer
      • encode

        public void encode​(double[][] values,
                           int srcOffset,
                           byte[] buf,
                           int offset,
                           int frames)
        Encode normalized double values to byte buffer.
        Parameters:
        values - double values for all channels
        buf - the buffer
        offset - bufPos in the buffer
      • encode

        public void encode​(double[] values,
                           int srcOffset,
                           byte[] buf,
                           int offset,
                           int samples)
        Encode normalized double values to byte buffer.
        Parameters:
        values - double values (one value per sample)
        srcOffset - offset in the source buffer
        buf - the buffer
        offset - offset in the target byte buffer
        samples - sample count to convert