Every transform in AudioTools follows a two-step API pattern:
instantiate(state, signal): This method calculates the specific parameters (like cutoff frequencies or noise levels) required for the transform. It uses a state (seed) to ensure reproducibility. It returns a dictionary of parameters.transform(signal, **kwargs): This method performs the actual audio processing using the parameters provided in kwargs.
You can check which arguments a transform expects by inspecting its .keys attribute.
from audiotools import transforms as tfm
transform = tfm.LowPass()
# Get parameters for a specific seed
kwargs = transform.instantiate(seed=0)
# See what keys are required
print(transform.keys) # e.g., ['cutoff', 'mask']
# Apply
output = transform(signal.clone(), **kwargs)