Skip to content
Packages Examples Agents Blog Get started

Configuration for the beat-analysis subsystem.

Provider that registers a configured BeatAnalysisProvider backend.
__init__
def __init__(
    config: BeatAnalysisConfig | None = None,
    *,
    backend_registry: BeatBackendRegistry | None = None
) -> None
register
async def register(container: ContainerRegistrarProtocol) -> None
boot
async def boot(container: ContainerResolverProtocol) -> None

No async I/O needed at boot beyond what register() already did.

health_check
async def health_check(timeout: float = 5.0) -> HealthCheckResult

Librosa/madmom tempo-and-beat-detection integration.
configure
def configure(
    cls,
    config: BeatAnalysisConfig | None = None
) -> DynamicModule
stub
def stub(
    cls,
    config: BeatAnalysisConfig | None = None
) -> DynamicModule

Talks to no server — runs librosa's beat tracker in-process.
__init__
def __init__(
    sample_rate: int = 22050,
    max_asset_bytes: int = DEFAULT_MAX_MEDIA_BYTES,
    max_analyze_samples: int = 60000000,
    resolver: HostResolver | None = None
) -> None

Configure the in-process librosa backend.

Parameters
ParameterTypeDescription
`sample_rate`intTarget sample rate for analysis.
`max_asset_bytes`intReject assets larger than this many bytes.
`max_analyze_samples`intReject decoded audio longer than this many samples.
`resolver`HostResolver | NoneOptional hostname resolver for the URL-safety check. Defaults to the system resolver.
analyze
async def analyze(request: BeatAnalysisRequest) -> Result[BeatAnalysisResult, MultimediaError]

Analyze an asset and return its tempo and beat timestamps.

Parameters
ParameterTypeDescription
`request`BeatAnalysisRequestThe asset to analyze.
Returns
TypeDescription
Result[BeatAnalysisResult, MultimediaError]Ok(analysis) on success, Err(error) when the asset is unsafe, oversized, or undecodable.

Talks to a madmom_server.py reference server via BeatAnalysisProvider.
__init__
def __init__(
    base_url: str,
    timeout: float = 30.0,
    retry: RetryPolicyProtocol | None = None,
    circuit_breaker: CircuitBreakerProtocol | None = None
) -> None
analyze
async def analyze(request: BeatAnalysisRequest) -> Result[BeatAnalysisResult, MultimediaError]

Audio could not be decoded, or was rejected before decoding.

Covers undecodable files, unsafe asset URIs, payloads over the max_asset_bytes cap, probed durations over the max_analyze_samples ceiling, and decoded arrays over the max_analyze_samples ceiling.