Package ai.djl.modality.audio
Class Audio
java.lang.Object
ai.djl.modality.audio.Audio
Audio is a container of an audio in DJL. The raw data of the audio is wrapped in a float
array.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintReturns the number of channels of an audio file.float[]getData()Returns the float array data.floatReturns the sample rate.
-
Constructor Details
-
Audio
public Audio(float[] data) Constructs a newAudioinstance.- Parameters:
data- the wrapped float array data
-
Audio
public Audio(float[] data, float sampleRate, int channels) Constructs a newAudioinstance.- Parameters:
data- the wrapped float array datasampleRate- the sample ratechannels- 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
-