📍 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

Volume Variance

Beta
Multi-turn
Referenceless
Chatbot
Voice

The volume variance metric checks whether your voice agent's volume drifts within a reply, like a sentence that starts loud and fades to a mumble, or one that swells as it goes. It returns the share of agent replies that hold a steady volume, between 0 and 1.

0.0s / 8.9s

Required Arguments

To use the VolumeVarianceMetric, you'll have to provide a ConversationalTestCase with audio on 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 VolumeVarianceMetric() 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 VolumeVarianceMetric
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 = VolumeVarianceMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])

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

  • [Optional] max_drift_db: an integer for how far, in dB, a reply's volume may rise or fall from its start to its end. Must be greater than 0. Defaulted to 15.

As a standalone

You can also run the VolumeVarianceMetric 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 whose volume drifted shows up in score_breakdown as one event. Here is what the example call returns:

{
    "eligible_turns": 3,
    "turns_with_events": 1,
    "events": [
        {
            "type": "volume_drift",
            "turn": 3,
            "timing_source": "turn_timestamps",
            "description": "Volume faded 17 dB during the reply",
            "drift_db": -17.2,
            "offset_seconds": 0.0,
            "duration_seconds": 7.0,
            "start_time": 12.5,
            "mark": "whole_reply",
        }
    ],
    "skipped": [
        {
            "turn": 5,
            "error": "Reply has under 6 seconds of speech to follow.",
        }
    ],
}
FieldWhat it means
drift_dbHow much the volume changed across the reply, in dB. Negative for a fade, positive for a swell

Each event covers the whole reply, so offset_seconds is 0 and duration_seconds is the clip's length. Replies that are too short, silent or 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 counted and turns_with_events how many drifted. The score is the share that didn't.

How Is It Calculated?

The VolumeVarianceMetric score is calculated according to the following equation:

Volume Variance=Number of Agent Replies Without a Volume DriftTotal Number of Agent Replies\text{Volume Variance} = \frac{\text{Number of Agent Replies Without a Volume Drift}}{\text{Total Number of Agent Replies}}

Which replies are scored

Agentw1w2little speechw3w4w5w6under 1 s0s2s4s6s8s

Each reply is cut into 1-second windows. A window is kept when it holds at least 0.3 seconds of speech (15 frames of 20 ms at about −41 dBFS or louder). Windows with less, such as the tail of a word, are left out, as is a last window under 1 second.

A reply is skipped when it:

  • has fewer than 6 windows kept, since a steady drift needs several seconds to tell apart from normal rises and falls, or
  • has no audible sound at all, which Silent Reply reports instead.

Drift criteria

SteadyFadingsteadyfades0s1s2s3s4s5s
CheckRule
Window levelThe median of the window's 5 loudest 20 ms frames, so pauses don't pull it down
Steady trendThe window levels keep moving one way: their rank correlation with time is 0.8 or more, up or down. If not, the drift is 0
DriftThe trend from the first kept window to the last, using the median slope between every pair of windows
DriftedThe drift is more than max_drift_db (15 dB) either way

Because of the trend check, a reply that dips and comes back, or rises and falls with the sentence, has no drift, however large the dip. Only a fade or swell that keeps going is measured, and the median slope stops one odd window from tilting it.

If no reply is long enough to follow, the metric is skipped.

Example call

A call where one agent reply fades steadily, one dips in the middle and comes back, and one is too short to follow.

Agentturn 1turn 3turn 5turn 7too shortdips, comes back0s5s10s15s20s25s30s35s
Agent turnDriftDrifted?
10.0 dBNo
3−17.2 dBYes
5Under 6 windowsSkipped
70.0 dB, no steady trendNo
3 replies1 drifted → 2/3 = 0.67

FAQs

How is this different from Loudness?
LoudnessMetric checks whether a reply's overall level is in range. This metric checks whether the level holds steady within the reply, so a reply can pass one and fail the other.
How is this different from Loudness Consistency?
LoudnessConsistencyMetric compares whole replies with each other. This metric looks inside one reply at a time.
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