Class Audio

java.lang.Object
ai.djl.modality.audio.Audio

public class Audio extends Object
Audio is a container of an audio in DJL. The raw data of the audio is wrapped in a float array.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Audio(float[] data)
    Constructs a new Audio instance.
    Audio(float[] data, float sampleRate, int channels)
    Constructs a new Audio instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    int
    Returns the number of channels of an audio file.
    float[]
    Returns the float array data.
    float
    Returns the sample rate.

    Methods inherited from class java.lang.Object

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

    • Audio

      public Audio(float[] data)
      Constructs a new Audio instance.
      Parameters:
      data - the wrapped float array data
    • Audio

      public Audio(float[] data, float sampleRate, int channels)
      Constructs a new Audio instance.
      Parameters:
      data - the wrapped float array data
      sampleRate - the sample rate
      channels - number of channels
  • Method Details

    • getData

      public float[] getData()
      Returns the float array data.
      Returns:
      The float array data.
    • getSampleRate

      public float getSampleRate()
      Returns the sample rate.
      Returns:
      sample rate.
    • getChannels

      public int getChannels()
      Returns the number of channels of an audio file.
      Returns:
      the number of channels of an audio file