📍 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

Background Noise

Beta
Multi-turn
Referenceless
Chatbot
Voice

The background noise metric checks whether your voice agent's speech has a constant hiss, hum or room noise behind it. It compares how loud the agent's speech is with the noise underneath it, and returns the share of agent replies where the speech stands well clear of the noise, between 0 and 1.

0.0s / 6.2s

Required Arguments

To use the BackgroundNoiseMetric, 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 BackgroundNoiseMetric() 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 BackgroundNoiseMetric
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 = BackgroundNoiseMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])

There are THREE optional parameters specific to the BackgroundNoiseMetric, on top of the common voice metric parameters:

  • [Optional] min_snr_db: an integer for the lowest signal-to-noise ratio (SNR: how far the speech sits above the noise), in dB, a reply may have before it counts as noisy. Must be 0 or more. Defaulted to 18.
  • [Optional] eval_mode: "deterministic" or "hybrid". In "hybrid", each noisy reply is double-checked by an audio decision model before it counts. Defaulted to the configured voice eval mode ("deterministic" unless set).
  • [Optional] audio_decision_model: the model that does the second check in "hybrid" mode. Defaulted to HumeDecisionModel().

As a standalone

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

{
    "eligible_turns": 3,
    "turns_with_events": 1,
    "events": [
        {
            "type": "background_noise",
            "turn": 3,
            "timing_source": "turn_timestamps",
            "description": "Background noise was high (SNR 13 dB)",
            "estimated_snr_db": 13.3,
            "offset_seconds": 0.0,
            "duration_seconds": 3.0,
            "start_time": 8.5,
            "mark": "whole_reply",
        }
    ],
    "skipped": [
        {
            "turn": 5,
            "error": "Reply is under 2 seconds, too short to measure its noise.",
        }
    ],
}
FieldWhat it means
estimated_snr_dbHow far the reply's speech sits above its background noise, in dB

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 were noisy. The score is the share that weren't.

How Is It Calculated?

The BackgroundNoiseMetric score is calculated according to the following equation:

Background Noise=Number of Agent Replies Without Background NoiseTotal Number of Agent Replies\text{Background Noise} = \frac{\text{Number of Agent Replies Without Background Noise}}{\text{Total Number of Agent Replies}}

Which replies are scored

Agentturn 1turn 3turn 5reply 1too shortreply 20s2s4s6s8s10s

A reply is skipped when it:

  • is under 2 seconds long, since noise is measured in the pauses between words and a short reply rarely has one, or
  • has no audible sound at all, which Silent Reply reports instead.

Noise criteria

Speech should sit far above the noise in its pauses. A noisy reply has a raised floor between words.

CleanNoisyquiet pausenoise

Each reply is cut into 20 ms frames and measured like this:

CheckRule
Speech levelThe 90th percentile of frames at speech volume (about −41 dBFS or louder)
Noise levelThe 10th percentile of all frames, leaving out digital silence
NoisySpeech level is less than min_snr_db (18 dB) above the noise level

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

Second check

In the hybrid eval mode, each noisy reply is double-checked before it counts. The audio decision model hears the agent's whole reply, from that turn's own clip, or from the reply cut from full call audio when no turn has audio, and is asked:

Is there distracting background noise behind the speaker?

If the model judges "no" more likely than "yes", the reply is dismissed and doesn't count against the score.

Example call

A call where one agent reply has a loud hiss behind it and one is too short to measure.

Agent1357too short0s5s10s15s20s
Agent turnSignal-to-noiseNoisy?
145.7 dBNo
313.3 dBYes
5Under 2 secondsSkipped
745.7 dBNo
3 replies1 noisy → 2/3 = 0.67

FAQs

How is this different from Speech Intelligibility?
SpeechIntelligibilityMetric runs this metric together with loudness, clipping and dropouts, and scores the share of replies none of them flagged. This metric reports noise alone, so you can see whether noise is why a call sounded bad.
What should I set min_snr_db to?
Keep the default of 18 dB for most agents. Raise it to 25 or 30 dB if your agent should sound studio-clean. Lower it if your agent deliberately plays ambient sound, like a busy call center.
Does this metric call an LLM or an external speech model?
Not by default. Detection is deterministic and runs locally over the audio, so it has no model or token cost. In the "hybrid" eval mode, each noisy reply is also checked by an audio decision model, at one paid request per noisy reply.
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