Python
Python binding for the Rapidly SDK, for servers, ML pipelines, and notebooks.
The Python binding wraps the C++ engine with a Pythonic API. Install with pip, integrate with NumPy arrays, process files in one call, or drive real-time streaming. The full engine runs natively; the Python layer is a thin idiomatic wrapper. See Overview for what's inside the engine.
Install
python -m pip install rapidlyWheels ship for Windows, Linux, and macOS. Python 3 and later.
Try it
The examples.py script in the Rapidly SDK on GitHub is the fastest starting point. It provides a command-line interface for trying models on audio files without writing code.
- Clone or download
examples.pyfrom the Rapidly SDK repository. - Open a terminal and
cdto the directory. - Run
python examples.pyand follow the on-screen prompts to pick a model and process a file.
Listing and updating models
Import the module and list the available models:
import rapidly
models = rapidly.list_models()
print(models)Download and update to the latest models:
rapidly.update_models()See Models for the catalog and picking guidance.
Licensing
Call add_license on the engine before constructing any processor. See Pricing for licensing options.
import rapidly
engine = rapidly.RapidlyEngine()
if not engine.add_license("lk_..."):
raise RuntimeError("Rapidly license could not be verified.")Process a file
Use process_file for one-shot file conversions:
import rapidly
# Initialize the engine
engine = rapidly.RapidlyEngine()
# List the available models in the models folder
models = rapidly.list_models()
# Create a processor to inspect the available output busses for the chosen model
processor = engine.create_processor(models[0], 2, 44100)
# Read the available output bus names
num_buses = processor.get_number_of_output_buses()
bus_names = [processor.get_output_bus_name(i) for i in range(num_buses)]Then run the file through the model:
rapidly.process_file(
model_file_path=models[0],
input_file_path=input_file_path,
output_file_path=output_file_path,
selected_output_bus=0, # The processed result is on bus 0 in most models
)This applies models[0] to input_file_path and writes the result to output_file_path.
rapidly.process_file uses PySoundFile to read and write audio files. PySoundFile is not required to use Rapidly, but it is a convenient library for handling audio files in Python.
Stream processing
For real-time or streaming workloads, drive a Processor directly with process():
import numpy as np
import rapidly
engine = rapidly.RapidlyEngine()
processor = engine.create_processor(
"models/speech-denoise-32ms.v1.0.rapidly", 2, 44100
)
# audio_block: np.ndarray of shape (num_samples, num_channels), dtype=float32
processed = processor.process(audio_block)
# Reset between unrelated streams to clear internal delay lines
processor.reset()
# Inspect the model configuration (sample rate, latency, block size, ...)
info = processor.get_info()Parameters
Processor exposes typed getters and setters for the most common controls, plus generic per-bus controls.
| Method | Description |
|---|---|
get_max_attenuation() / set_max_attenuation(value) | Maximum attenuation in dB. Range: (-∞, 0]. |
get_sensitivity() / set_sensitivity(value) | Processing sensitivity. Range: -100% to 100%. 0% is neutral. |
get_output_bus_volume(bus) / set_output_bus_volume(bus, value) | Linear gain for an output bus. Range: 0 and up. |
set_output_bus_sensitivity(bus, value) | Per-bus sensitivity. Range: -100% to 100%. |
get_number_of_output_buses() | Number of output busses available. |
get_output_bus_name(index, max_length=256) | Name of the output bus at index. |
get_parameter_range(parameter_index) | Minimum and maximum values for a parameter ID. |
Threading
Drive each processor from a single thread. For short offline jobs use a with block to release the native resources automatically; for long-running real-time work call the processor's release method explicitly. For backends running many streams in parallel, see Parallel processing and One vs multiple engines.