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) -> ModelParamsReturns model parameters for the given name. Case-sensitive.
Returns
- A
ModelParamsinstance.
Raises
ValueErrorif 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_rateModelParams 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 eachprocess()call.output_chunk_size_samples(int) – Length of eachprocess()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) -> NoneInitializes 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– AModelParamsinstance fromrevoize_sdk.models.get_params("Capella")(or another name fromlist_names()).
Raises
ValueErrorif the argument is not a validModelParams.RuntimeErrorif 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.ndarrayProcesses one chunk of input audio and returns the enhanced chunk.
WARNING
- Call
init()with the desired model’sModelParamsbefore using this function. audio_chunkmust be a 1-D NumPy array offloat32with exactlymodel_params.input_chunk_size_sampleselements (from theModelParamsused ininit()).- Input sample rate must match the model (see
params.input_sample_rate). Output length will beparams.output_chunk_size_samples.
Parameters
audio_chunk– 1-D NumPy array offloat32, length =input_chunk_size_samplesof the initialized model.
Returns
- NumPy array of
float32with lengthoutput_chunk_size_samples.
Raises
ValueErrorif the array is not 1-D or has the wrong length.RuntimeErrorif 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")