Package ai.djl.modality.audio
Class SampledAudioFactory
java.lang.Object
ai.djl.modality.audio.AudioFactory
ai.djl.modality.audio.SampledAudioFactory
SampledAudioFactory is an implementation of ImageFactory using the Java Sampled
Package.-
Field Summary
Fields inherited from class ai.djl.modality.audio.AudioFactory
channels, sampleFormat, sampleRate -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturnsAudiofrom file.ReturnsAudiofromInputStream.setChannels(int channel) Sets the number of channels forAudioFactoryto use.setSampleFormat(int sampleFormat) Sets the audio sample format forAudioFactoryto use.setSampleRate(int sampleRate) Sets the sampleRate forAudioFactoryto use.Methods inherited from class ai.djl.modality.audio.AudioFactory
fromData, fromNDArray, fromUrl, fromUrl, getChannels, getSampleFormat, getSampleRate, newInstance
-
Constructor Details
-
SampledAudioFactory
public SampledAudioFactory()
-
-
Method Details
-
setChannels
Sets the number of channels forAudioFactoryto use.- Overrides:
setChannelsin classAudioFactory- Parameters:
channel- the number of channels forAudioFactoryto use- Returns:
- this factory
-
setSampleRate
Sets the sampleRate forAudioFactoryto use.- Overrides:
setSampleRatein classAudioFactory- Parameters:
sampleRate- the sampleRate forAudioFactoryto use- Returns:
- this factory
-
setSampleFormat
Sets the audio sample format forAudioFactoryto use.- Overrides:
setSampleFormatin classAudioFactory- Parameters:
sampleFormat- the sample format- Returns:
- this factory.
-
fromFile
ReturnsAudiofrom file.- Specified by:
fromFilein classAudioFactory- Parameters:
path- the path to the audio- Returns:
Audio- Throws:
IOException- Audio not found or not readable
-
fromInputStream
ReturnsAudiofromInputStream.- Specified by:
fromInputStreamin classAudioFactory- Parameters:
is-InputStream- Returns:
Audio- Throws:
IOException- image cannot be read from input stream.
-