foley.eval.aesthetics#
Per-clip generation quality from Meta’s Audiobox Aesthetics, run in its own interpreter (#262).
Audiobox Aesthetics
(Tjandra et al. 2025, arXiv:2502.05139) predicts four scores, each on about 1 to 10,
for one clip of speech, music or sound: CE content enjoyment, CU content
usefulness, PC production complexity, PQ production quality
(AES_AXES). It is a WavLM encoder with four regression heads, so it scores a
clip on its own, with no reference set and no prompt: a per-sample signal, where FAD
and KAD (foley.eval.fadtk, foley.eval.kadtk) are set-level.
The package pulls a recent torch and torchaudio foley does not depend on, so
AudioboxAesthetics runs it through the same mechanism as fadtk and kadtk
(ExternalToolkit: temporary mono WAVs,
foley.eval.toolkit_driver in the toolkit’s interpreter, JSON back):
aes = AudioboxAesthetics(python="~/venvs/aes/bin/python") # or $FOLEY_AES_PYTHON
[score] = aes([wav], sr=48000)
score.axes # {'CE': 2.48, 'CU': 5.79, 'PC': 1.74, 'PQ': 6.03}
aesthetics_verdict() turns a score into the JSON-safe dict foley.generate
records as qc['aesthetics'] when asked (generate(..., aesthetics=True)). It is
a record, not a gate: with no AudioboxAesthetics.floors its status is
'scored'; with floors, 'low' flags the clip in the notes, and it is still
stored. The model is not a fault detector: digital silence scored PQ 7.0, above a
clean tone (6.0) and white noise (4.8), so Tier-0 QC (foley.qc) stays the gate
for broken audio, and no floor is calibrated for SFX yet.
Licences: the code is CC-BY-4.0, with parts from microsoft/unilm under MIT. Meta’s
README states no separate licence for the weights; the Hugging Face repo that holds
them (facebook/audiobox-aesthetics, about 415 MB) is tagged cc-by-4.0.
Module Attributes
The four axes, in the toolkit's order, → what each one rates. |
|
The environment variable naming the toolkit's interpreter when |
Functions
|
Score |
|
The one-line candidate note for an |
|
|
Classes
|
One clip's Audiobox Aesthetics scores, stamped with the model and toolkit version. |
|
Per-clip Audiobox Aesthetics scores computed in a separate interpreter. |
- foley.eval.aesthetics.AES_AXES: Mapping[str, str] = {'CE': 'content enjoyment', 'CU': 'content usefulness', 'PC': 'production complexity', 'PQ': 'production quality'}#
The four axes, in the toolkit’s order, → what each one rates.
- foley.eval.aesthetics.AES_PYTHON_ENV = 'FOLEY_AES_PYTHON'#
The environment variable naming the toolkit’s interpreter when
python=is not given.
- class foley.eval.aesthetics.AestheticsScore(axes, model, version, toolkit='audiobox_aesthetics')[source]#
Bases:
objectOne clip’s Audiobox Aesthetics scores, stamped with the model and toolkit version.
- class foley.eval.aesthetics.AudioboxAesthetics(*, checkpoint=None, batch_size=10, min_seconds=0.025, floors=None, timeout=300.0, **kwargs)[source]#
Bases:
ExternalToolkitPer-clip Audiobox Aesthetics scores computed in a separate interpreter.
:param those of
ExternalToolkit(python: :param : :paramenv: :paramtimeout: :paramrunner): :param plus: :type checkpoint:Optional[str] :param checkpoint: A localcheckpoint.pt(default: the Hugging Face weights,downloaded once into the toolkit’s
HF_HOME; passenv={"HF_HOME": ...}to choose where).- Parameters:
batch_size (
int) – Clips a forward pass.min_seconds (
float) – The shortest clip scored (defaultAES_MIN_SECONDS).timeout (
Optional[float]) – Seconds before a run is abandoned (defaultAES_TIMEOUT_S;Nonewaits forever).floors (
Optional[Mapping[str,float]]) – Axis → the lowest acceptable score, read byaesthetics_verdict()(default none: the verdict only records).
- check_clip(clip, *, sr, name)[source]#
Refuse a clip shorter than
min_seconds, or with a NaN or infinite sample.- Return type:
- failure_hints: Mapping[str, str] = {"No module named 'requests'": "audiobox_aesthetics imports requests without declaring it. Install: uv venv ~/venvs/aes --python 3.11 && uv pip install --python ~/venvs/aes/bin/python audiobox_aesthetics requests; then AudioboxAesthetics(python='~/venvs/aes/bin/python') or set FOLEY_AES_PYTHON"}#
A substring of a failed run’s output → what to do about it.
- foley.eval.aesthetics.aesthetics_verdict(audio_bytes, *, scorer)[source]#
Score
audio_byteswithscorerand compare with itsfloors; never raises.- Returns:
status(scored|ok|low|unchecked), and the four axes (Nonefor a non-finite one),model,toolkitandversionwhen scored, plusfloorsand the axesbelowthem when the scorer has floors; or a shortreason(_reason(): no paths, no program output) when not scored: no interpreter, a clip too short, a timeout, a crash, a scorer answering anything but one well-formed score.- Return type:
>>> import numpy as np >>> from foley.audio import encode >>> clip = encode(np.zeros(1600), 16000) >>> aesthetics_verdict(clip, scorer=lambda wavs, *, sr: [])["reason"] 'ValueError: the scorer returned 0 scores for 1 clip'
- foley.eval.aesthetics.note_for(result)[source]#
The one-line candidate note for an
aesthetics_verdict()result.
- foley.eval.aesthetics.resolve_aesthetics(aesthetics)[source]#
generate(aesthetics=)as a scorer:None/Falsenone,Truethe defaultAudioboxAesthetics, a scorer ((wavs, *, sr) -> [AestheticsScore]) as is.An external-toolkit scorer’s interpreter is resolved here, so an explicit opt-in without one fails before anything is paid for (as
watermark=Truedoes).- Raises:
FileNotFoundError – If the scorer’s interpreter is not given or not found.
TypeError – For any other value.