Skip to content

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

java
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

java
import revoize.SDK;

String[] names = SDK.models.listNames();
for (String name : names) {
    System.out.println("Available model: " + name);
}

getParams Method

java
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.ModelParams for the model, or null if the name is unknown or the model is not available in this build.

Example

java
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

java
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 – A SDK.ModelParams from SDK.models.getParams("Capella") (or another name from listNames()). Must not be null.

Returns

  • 0 on success.
  • -1 on failure (e.g. null params, unknown model, or init error).

Example

java
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

java
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.length must equal exactly the inputChunkSizeSamples (or equivalent) of the ModelParams used in init().
  • Input sample rate must match the model. Output length will match the model’s output chunk size.

Parameters

  • input – Array of float single-channel audio samples. Length must match the initialized model’s input chunk size.

Returns

  • Array of float enhanced samples (length = model’s output chunk size).

Throws

  • IllegalArgumentException if the input array is null or has wrong length.
  • IllegalStateException if the SDK is not initialized or processing fails.

Example

java
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());
        }
    }
}