Revoize SDK Java API Reference
This page documents the Java API (including Kotlin and Android). Use SDK.models.listNames() and SDK.models.getParams(name) to get parameters, then SDK.init(modelParams) and SDK.process(input) to run enhancement.
Package: revoize (e.g. revoize.SDK, revoize.SDK.ModelParams).
SDK.models (model registry)
listNames Method
public static String[] listNames()Returns the list of available model names for this build (e.g. "Capella", "Octantis", "Hadar"). Only models enabled in the build are included.
Example
import revoize.SDK;
String[] names = SDK.models.listNames();
for (String name : names) {
System.out.println("Available model: " + name);
}getParams Method
public static SDK.ModelParams getParams(String modelName)Returns model parameters for the given name. Case-sensitive.
Parameters
modelName– Model name (e.g."Capella","Octantis","Hadar").
Returns
SDK.ModelParamsfor the model, ornullif the name is unknown or the model is not available in this build.
Example
import revoize.SDK;
SDK.ModelParams params = SDK.models.getParams("Capella");
if (params == null) {
System.err.println("Model not available");
return;
}
int chunkSize = params.getInputChunkSizeSamples();
int inputSr = params.getInputSampleRate();SDK.ModelParams Class
Model parameters for a given model. Obtain via SDK.models.getParams(name); do not construct manually. Pass to SDK.init(modelParams).
Typical getters (names may follow your project’s Java conventions, e.g. getInputChunkSizeSamples(), getOutputChunkSizeSamples(), getInputSampleRate(), getOutputSampleRate()). The constructor is (int modelTypeValue, int inputChunkSizeSamples, int outputChunkSizeSamples, int inputSampleRate, int outputSampleRate) and is used internally; applications should only use params returned from getParams(name).
- Input chunk size – Required length of each
process()input array. - Output chunk size – Length of each
process()output array. - Input / output sample rates – In Hz; may differ for bandwidth-extension models.
SDK.init Method
Signature
public static int init(SDK.ModelParams modelParams)Initializes the SDK with the given model parameters. Call once before process(). On Android, an overload may accept an ONNX Runtime library path.
Parameters
modelParams– ASDK.ModelParamsfromSDK.models.getParams("Capella")(or another name fromlistNames()). Must not be null.
Returns
0on success.-1on failure (e.g. null params, unknown model, or init error).
Example
import revoize.SDK;
SDK.ModelParams params = SDK.models.getParams("Capella");
if (params == null || SDK.init(params) != 0) {
System.err.println("Failed to initialize Revoize SDK");
return;
}SDK.process Method
Signature
public static float[] process(float[] input)Processes one chunk of input audio and returns the enhanced chunk.
WARNING
- Call
SDK.init(modelParams)before using this method. input.lengthmust equal exactly theinputChunkSizeSamples(or equivalent) of theModelParamsused ininit().- Input sample rate must match the model. Output length will match the model’s output chunk size.
Parameters
input– Array offloatsingle-channel audio samples. Length must match the initialized model’s input chunk size.
Returns
- Array of
floatenhanced samples (length = model’s output chunk size).
Throws
IllegalArgumentExceptionif the input array is null or has wrong length.IllegalStateExceptionif the SDK is not initialized or processing fails.
Example
import revoize.SDK;
public class Example {
public static void main(String[] args) {
try {
SDK.ModelParams params = SDK.models.getParams("Capella");
if (params == null || SDK.init(params) != 0) {
System.err.println("Failed to initialize Revoize SDK");
return;
}
int chunkSize = params.getInputChunkSizeSamples();
float[] audioChunk = new float[chunkSize];
for (int i = 0; i < chunkSize; i++) {
audioChunk[i] = 0.0f;
}
float[] enhancedAudio = SDK.process(audioChunk);
System.out.println("Enhanced audio has " + enhancedAudio.length + " samples");
} catch (IllegalArgumentException | IllegalStateException e) {
System.err.println("Error: " + e.getMessage());
}
}
}