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 TypeMethodDescriptionReturnsAudio
from file.ReturnsAudio
fromInputStream
.setChannels
(int channel) Sets the number of channels forAudioFactory
to use.setSampleFormat
(int sampleFormat) Sets the audio sample format forAudioFactory
to use.setSampleRate
(int sampleRate) Sets the sampleRate forAudioFactory
to 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 forAudioFactory
to use.- Overrides:
setChannels
in classAudioFactory
- Parameters:
channel
- the number of channels forAudioFactory
to use- Returns:
- this factory
-
setSampleRate
Sets the sampleRate forAudioFactory
to use.- Overrides:
setSampleRate
in classAudioFactory
- Parameters:
sampleRate
- the sampleRate forAudioFactory
to use- Returns:
- this factory
-
setSampleFormat
Sets the audio sample format forAudioFactory
to use.- Overrides:
setSampleFormat
in classAudioFactory
- Parameters:
sampleFormat
- the sample format- Returns:
- this factory.
-
fromFile
ReturnsAudio
from file.- Specified by:
fromFile
in classAudioFactory
- Parameters:
path
- the path to the audio- Returns:
Audio
- Throws:
IOException
- Audio not found or not readable
-
fromInputStream
ReturnsAudio
fromInputStream
.- Specified by:
fromInputStream
in classAudioFactory
- Parameters:
is
-InputStream
- Returns:
Audio
- Throws:
IOException
- image cannot be read from input stream.
-