📍 Join the 1st DeepEval meetup in SF, this Friday 5pm PT. RSVP on Luma →
💥 Introducing JevEval: Jev-as-a-Judge for LLM evaluation. Read the post →
Voice AgentsAudio Level

Loudness Consistency

Beta
Multi-turn
Referenceless
Chatbot
Voice

The loudness consistency metric checks whether your voice agent keeps the same volume from one reply to the next, rather than one reply being clearly louder or quieter than the rest. It returns the share of agent replies that stay close to the agent's typical loudness, between 0 and 1.

CallerAgent
0.0s / 20.6s

Required Arguments

To use the LoudnessConsistencyMetric, you'll have to provide a ConversationalTestCase with audio on at least three of the agent's turns, or on the test case as a stereo recording of the whole call*.

* Full call audio has to be stereo, with the caller and agent on separate channels, and is only used when no turn has audio. Each agent reply is then heard on the agent's channel, from its first sound until the caller speaks.

Usage

The LoudnessConsistencyMetric() can be used for end-to-end evaluation of voice calls, such as ones produced by the ConversationSimulator in voice mode:

from deepeval import evaluate
from deepeval.dataset import ConversationalGolden
from deepeval.metrics import LoudnessConsistencyMetric
from deepeval.simulator import ConversationSimulator
from deepeval.voice import ElevenLabsConnector, VoiceConfig


golden = ConversationalGolden(
    scenario="The user asks the agent to look up an order by its number.",
    expected_outcome="The agent reads back the order status.",
)

simulator = ConversationSimulator(
    voice_config=VoiceConfig(
        connector=ElevenLabsConnector(agent_id="your-agent-id"),
    )
)
test_cases = simulator.simulate([golden])

metric = LoudnessConsistencyMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])

There is ONE optional parameter specific to the LoudnessConsistencyMetric, on top of the common voice metric parameters:

  • [Optional] max_shift_db: an integer for how far, in dB, a reply's loudness may sit from the agent's typical loudness. Must be greater than 0. Defaulted to 7.

As a standalone

You can also run the LoudnessConsistencyMetric on a single test case as a standalone, one-off execution:

metric.measure(test_cases[0])

print(metric.score, metric.reason)
print(metric.score_breakdown)

See Events for what score_breakdown contains.

Events

Each reply that was clearly louder or quieter than usual shows up in score_breakdown as one event. Here is what the example call returns:

{
    "eligible_turns": 4,
    "turns_with_events": 1,
    "events": [
        {
            "type": "loudness_shift",
            "turn": 5,
            "timing_source": "turn_timestamps",
            "description": "Reply was 8 dB quieter than usual",
            "speech_dbfs": -27.1,
            "shift_db": -7.9,
            "offset_seconds": 0.0,
            "duration_seconds": 3.0,
            "start_time": 14.5,
            "mark": "whole_reply",
        }
    ],
    "skipped": [],
}
FieldWhat it means
speech_dbfsThe reply's speech level, in dBFS
shift_dbHow far that sits from the agent's typical level. Negative when quieter

Each event covers the whole reply, so offset_seconds is 0 and duration_seconds is the clip's length. Replies with under 1 second of speech, including silent ones, and replies that can't be decoded are listed under skipped. Every event also has the fields all voice events share, such as mark and description.

eligible_turns is how many agent replies were compared and turns_with_events how many were off. The score is the share that weren't.

How Is It Calculated?

The LoudnessConsistencyMetric score is calculated according to the following equation:

Loudness Consistency=Number of Agent Replies Near the Typical LoudnessTotal Number of Agent Replies\text{Loudness Consistency} = \frac{\text{Number of Agent Replies Near the Typical Loudness}}{\text{Total Number of Agent Replies}}

Which replies are scored

Agentturn 1turn 3turn 5turn 7reply 1no speechreply 2reply 30s2s4s6s8s10s

A reply is compared if its speech spans at least 1 second, the same rule Loudness uses. A reply with no audible sound at all is left to Silent Reply.

At least 3 such replies are needed to tell which one is off. With fewer, the metric is skipped.

Shift criteria

Agentmuch quieterclosetypical: median of all four0s2s4s6s8s10s

Each reply's speech level is measured as in Loudness: the 90th percentile of its 20 ms frames at speech volume. The agent's typical level is the median across its replies, so one odd reply is flagged instead of shifting what counts as typical.

CheckRule
ShiftThe reply's speech level minus the typical level
OffThe shift is more than max_shift_db (7 dB) either way

Example call

A call where one agent reply comes out much quieter than the rest. The agent's typical level is −19.2 dBFS.

Agentturn 1turn 3turn 5turn 70s5s10s15s20s
Agent turnSpeech levelShiftOff?
1−19.2 dBFS0.0 dBNo
3−19.2 dBFS0.0 dBNo
5−27.1 dBFS−7.9 dBYes
7−18.4 dBFS+0.8 dBNo
4 replies1 off → 3/4 = 0.75

FAQs

How is this different from Loudness?
LoudnessMetric checks each reply against a fixed range. This metric checks replies against each other. A reply that is far too quiet next to normal ones can fail both.
How is this different from Volume Variance?
VolumeVarianceMetric checks whether the volume drifts within one reply. This metric compares whole replies with each other.
Does this metric call an LLM or an external speech model?
No. Detection is deterministic and runs locally over the audio, so it has no model or token cost.
Does it check the caller's audio too?
No. Only the agent's replies are scored. The caller is your simulator's TTS voice or a real customer, so their audio says nothing about the agent.

On this page