foley.sources.capabilities#
What each live source emits, and what foley plans to support: list_backends + ledger.
A SOURCE_CONFIG already says which vendor knobs a source accepts
(supported_affordances). This module reads the same declarations and answers
the questions a caller asks before choosing a backend: is the output reproducible
from a seed, can it loop, how long can a clip be, does it run on-device?
capabilities_of()is one pure view over a config: facts derived from the fields that are already the SSOT (supported_affordances,data_egress,native_defaults), overlaid with an optional explicitconfig['capabilities']block for facts a config cannot imply (sample_rate,watermarked, …).list_backends()filters the registry bykindandsupports.ledger()computes implemented vs planned from the registry andfoley/data/targets.json(planned backends that otherwise live only in prose). A planned target drops out ofplannedby itself once a source of that name is registered, so the ledger cannot drift from the code.
Functions
|
The capability view of one |
|
Implemented vs planned backends, computed from the registry (never hand-kept). |
|
Names of registered live sources, filtered by |
The planned-backend list shipped as |
- foley.sources.capabilities.capabilities_of(config)[source]#
The capability view of one
SOURCE_CONFIG(JSON-safe).Keys:
kind,affordances(what the source accepts),deterministic(aseedis honoured),loopable(a nativeloopis honoured),offline_capable(data_egress == 'local'),max_duration_s/min_duration_s/sample_rate(Nonewhen undeclared).deterministicandloopableareNonefor retrieve sources (they only describe the generating kinds,'generate'and'procedural'). Aconfig['capabilities']dict adds facts a config cannot imply (e.g.watermarked); it may not redefine a derived key, except to narrow a derivedTruetoFalse(pyfxr takes a seed, but its noise waveform does not reproduce, so it declaresdeterministic: False).- Raises:
ValueError – If
config['capabilities']widens or retypes a derived key.- Return type:
- foley.sources.capabilities.ledger(*, targets=None)[source]#
Implemented vs planned backends, computed from the registry (never hand-kept).
- Parameters:
targets (
Optional[list[dict]]) – Planned backends (defaultload_targets()), each{name, kind, note}.- Return type:
- Returns:
{'implemented': {name: capabilities}, 'planned': [target, ...]};plannedholds only targets with no registered source of that name.
- foley.sources.capabilities.list_backends(*, kind=None, supports=None)[source]#
Names of registered live sources, filtered by
kindand by what they support.- Parameters:
kind (
Optional[str]) –'generate','procedural'or'retrieve'(None: all).supports (
Union[str,list[str],None]) – One name or a list (all must hold). A name is an affordance the source accepts ('seed','negative_prompt','loop'…) or a true flag ofcapabilities_of()('deterministic','loopable','offline_capable', or any boolean fact a config declares).
- Raises:
ValueError – On an unknown
kindorsupportsname (a typo must not read as “nothing supports it”).- Return type:
>>> import foley >>> 'stable_audio' in foley.list_backends(supports='seed') True