Revoize SDK Java API Reference
ModelType Enum
The ModelType enum defines the AI models available in the Revoize SDK:
java
public enum ModelType {
/// **Capella:** A lightweight model designed for real-time applications.
CAPELLA(0),
/// **Algol:** A generative model with advanced capabilities.
ALGOL(1),
/// **Regulus:** A lightweight model designed for real-time applications.
REGULUS(2),
/// **Octantis:** A lightweight model designed for real-time applications.
OCTANTIS(3);
private final int value;
ModelType(int value) {
this.value = value;
}
public int getValue() {
return value;
}
}init Function
Signature
java
public static boolean init(ModelType modelType)The init function is your starting point for using the Revoize SDK. It sets up the SDK with the specified model type. Note: Make sure to call this function before any other SDK functions to ensure everything is properly set up.
Parameters
modelTypeThe model type to initialize the SDK with.
Returns
trueif initialization is successful.falseif initialization fails.
Example
java
import revoize.SDK;
import revoize.SDK.ModelType;
public class Example {
public static void main(String[] args) {
// Initialize the SDK with the Capella model.
if (!SDK.init(ModelType.CAPELLA)) {
System.err.println("Failed to initialize Revoize SDK");
return;
}
}
}process Function
Signature
java
public static float[] process(float[] input)The process function takes an input audio chunk and returns the enhanced chunk.
WARNING
- Ensure
init()is called before using this function. - The
inputshould be from a 48 kHz recording. - The input array cannot be null or empty.
Parameters
inputAn array offloatvalues representing single-channel audio samples recorded at 48 kHz.
Returns
- An array of
floatvalues containing the enhanced audio samples.
Throws
IllegalArgumentExceptionif the input array is null or empty.IllegalStateExceptionif processing fails (e.g., if the SDK has not been initialized).
Example
java
import revoize.SDK;
import revoize.SDK.ModelType;
public class Example {
public static void main(String[] args) {
try {
// Initialize the SDK first
if (!SDK.init(ModelType.CAPELLA)) {
System.err.println("Failed to initialize Revoize SDK");
return;
}
// Create an example audio chunk (e.g., 10 frames of 480 samples each)
float[] audioChunk = new float[4800];
for (int i = 0; i < audioChunk.length; i++) {
audioChunk[i] = 1.0f;
}
// Process the audio
float[] enhancedAudio = SDK.process(audioChunk);
System.out.println("Enhanced audio has " + enhancedAudio.length + " samples");
} catch (IllegalArgumentException | IllegalStateException e) {
System.err.println("Error: " + e.getMessage());
}
}
}