Class PcmUtil

java.lang.Object
de.pottgames.tuningfork.misc.PcmUtil

public abstract class PcmUtil extends Object
  • Constructor Details

    • PcmUtil

      public PcmUtil()
  • Method Details

    • reverseAudio

      public static byte[] reverseAudio(byte[] pcmData, int sampleSizeInBytes)
      Reverses the audio data.
      Parameters:
      pcmData - the source array of pcm data
      sampleSizeInBytes - the bytes per sample
      Returns:
      the reversed audio data
    • averageSample

      public static float averageSample(byte[] input, PcmFormat format, int startSample, int endSample, int channel)
      Calculates the average amplitude of a slice of samples. The result is always in the range 0 - 1. With 0 equals silence and 1 equals full amplitude.
      Parameters:
      input - the input byte array containing the samples
      format - the data format of the input byte array
      startSample - the start index of the desired slice
      endSample - the end index of the desired slice
      channel - the channel number samples will be read from
      Returns:
      the average amplitude of all samples in the slice in the range 0 - 1