Audio Quality
Evaluates the perceptual quality of an audio file, assessing clarity, noise levels, and overall listenability.
Audio Quality checks how clear and listenable an audio file is, independent of what’s being said. Run it to catch noise, distortion, and other recording issues before they affect downstream processing.
What it does
Audio Quality is an LLM-as-Judge eval. It listens to the audio and scores its perceptual quality, covering clarity, background noise, and distortion.
Input
| Required Input | Type | Description |
|---|---|---|
input_audio | string | Audio as a data URL, or an audio URL the evaluator can fetch |
Output
| Field | Type | Description |
|---|---|---|
| Result | score | Higher scores indicate better audio quality |
| Reason | string | A plain-language explanation of the audio quality assessment |
Run it from code
In Python, call evaluate() with the template name and the eval’s required inputs. It returns the score and the reason.
Note
Set FI_API_KEY and FI_SECRET_KEY. For Python, create a virtual environment with python3.12 -m venv .venv, activate it with source .venv/bin/activate, then run python -m pip install agent-learning-kit==0.3.7.
For TypeScript, use Node.js 22.18 or later, run npm install @future-agi/agent-learning-kit@0.4.0, save the example as score.mts, and run node score.mts. It submits the evaluation with Evaluator.submit(), polls getEvalResult() until the run finishes, and prints the result, the reason, and the evaluation ID.
Turing models are hosted Future AGI evaluators. On Cloud, each run uses AI credits from your organization’s plan. A self-hosted install can call them only with a license that lists the turing_models feature; air-gapped installs cannot use them. On a self-hosted install, set FI_BASE_URL to your API URL first. Without it, your keys and inputs go to Future AGI Cloud.
Use a short WAV file named return.wav. If you do not have a recording, create a synthetic support call sample with FFmpeg built with the flite filter:
ffmpeg -hide_banner -loglevel error -f lavfi -i "flite=text=I would like to return my hiking boots" -c:a pcm_s16le return.wav
Save the Python example as score.py and run python score.py. It prints the score, the reason, and the evaluation ID. The model argument selects the evaluator model, not the model that wrote the response.
import base64
from pathlib import Path
from fi.evals import evaluate
audio = base64.b64encode(Path("return.wav").read_bytes()).decode("ascii")
result = evaluate(
"audio_quality",
input_audio=f"data:audio/wav;base64,{audio}",
model="turing_large",
)
if result.score is None:
raise RuntimeError(result.error or result.reason or "No score returned")
print(result.score)
print(result.reason)
print(result.metadata["eval_id"])import { readFileSync } from "node:fs";
import { Evaluator } from "@future-agi/agent-learning-kit";
const evaluator = new Evaluator();
const run = await evaluator.submit(
"audio_quality",
{
input_audio: `data:audio/wav;base64,${readFileSync("return.wav").toString("base64")}`
},
{ modelName: "turing_large" }
);
let { result } = await evaluator.getEvalResult(run.id);
for (let i = 0; i < 60 && !["completed", "failed"].includes(result?.eval_status); i++) {
await new Promise((resolve) => setTimeout(resolve, 2000));
({ result } = await evaluator.getEvalResult(run.id));
}
if (result?.eval_status !== "completed" || result.result?.value == null) {
throw new Error(result?.result?.error_message ?? "No result returned");
}
console.log(result.result.value);
console.log(result.result.reason);
console.log(run.id); When to use
Run Audio Quality wherever an audio file’s recording condition matters on its own, separate from its content.
- Audio inputs and outputs, to catch clarity or noise issues before further processing
- Voice pipelines, to filter out recordings that are too degraded for reliable downstream use
- Quality gating for uploaded or generated audio before it reaches a listener
What to do when Audio Quality fails
If the audio quality score is lower than expected:
- Check for background noise or interference in the recording
- Verify the recording environment is appropriate (e.g., proper acoustic treatment)
- Ensure the microphone or recording device is of sufficient quality
- Consider using noise reduction techniques in post-processing
- Check for issues like clipping, distortion, or compression artifacts
- Verify the audio file format and bitrate are appropriate for the intended use
- Re-record in a more controlled environment if possible
Questions & Discussion