Skip to content

Revoize SDK Python API Reference

This page covers the Python API. Use the revoize_sdk.models submodule to get parameters by name, then init and process to run enhancement.

revoize_sdk.models Submodule

list_names Function

python
def list_names() -> list[str]

Returns the list of available model names for this build (e.g. "Capella", "Octantis", "Hadar"). Only models enabled in the build are included.

Example

python
import revoize_sdk

for name in revoize_sdk.models.list_names():
    print("Available:", name)

get_params Function

python
def get_params(model_name: str) -> ModelParams

Returns model parameters for the given name. Case-sensitive.

Returns

  • A ModelParams instance.

Raises

  • ValueError if the model name is unknown or not supported in this build.

Example

python
import revoize_sdk

params = revoize_sdk.models.get_params("Capella")
chunk_size = params.input_chunk_size_samples  # e.g. 480
input_sr = params.input_sample_rate          # e.g. 48000
output_sr = params.output_sample_rate

ModelParams Class

Model parameters for a given model. Obtain via revoize_sdk.models.get_params(name); do not construct manually.

Attributes (read-only):

  • model_type (str) – Model name (e.g. "Capella", "Octantis", "Hadar").
  • input_chunk_size_samples (int) – Required input chunk length for each process() call.
  • output_chunk_size_samples (int) – Length of each process() output.
  • input_sample_rate (int) – Input sample rate in Hz.
  • output_sample_rate (int) – Output sample rate in Hz (may differ for bandwidth extension (BWE) models).

init Function

Signature

python
def init(model_params: ModelParams) -> None

Initializes the SDK with the given model parameters. Call once before any process() call. Pass a ModelParams from revoize_sdk.models.get_params(name).

Parameters

  • model_params – A ModelParams instance from revoize_sdk.models.get_params("Capella") (or another name from list_names()).

Raises

  • ValueError if the argument is not a valid ModelParams.
  • RuntimeError if initialization fails (e.g. ONNX session or state setup).

Example

python
import revoize_sdk

model_params = revoize_sdk.models.get_params("Capella")
revoize_sdk.init(model_params)

process Function

Signature

python
def process(audio_chunk: numpy.ndarray) -> numpy.ndarray

Processes one chunk of input audio and returns the enhanced chunk.

WARNING

  • Call init() with the desired model’s ModelParams before using this function.
  • audio_chunk must be a 1-D NumPy array of float32 with exactly model_params.input_chunk_size_samples elements (from the ModelParams used in init()).
  • Input sample rate must match the model (see params.input_sample_rate). Output length will be params.output_chunk_size_samples.

Parameters

  • audio_chunk – 1-D NumPy array of float32, length = input_chunk_size_samples of the initialized model.

Returns

  • NumPy array of float32 with length output_chunk_size_samples.

Raises

  • ValueError if the array is not 1-D or has the wrong length.
  • RuntimeError if the SDK is not initialized or processing fails.

Example

python
import numpy as np
import revoize_sdk

model_params = revoize_sdk.models.get_params("Capella")
revoize_sdk.init(model_params)

chunk_size = model_params.input_chunk_size_samples
audio_chunk = np.ones(chunk_size, dtype=np.float32)
enhanced = revoize_sdk.process(audio_chunk)
assert len(enhanced) == model_params.output_chunk_size_samples
print("Enhanced audio has", len(enhanced), "samples")