Held Tone
The held tone metric checks whether your voice agent's audio contains a stuck tone or drone, such as a steady beep or a sound frozen on one pitch. It returns the share of agent replies with no held tone, between 0 and 1.
Required Arguments
To use the HeldToneMetric, 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*.
With per-turn audio, an Audio.start_time on each clip is optional, and only used to place events on the call's clock.
* 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 HeldToneMetric() 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 HeldToneMetric
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 = HeldToneMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])The HeldToneMetric has no optional parameters of its own. It takes only the common voice metric parameters.
As a standalone
You can also run the HeldToneMetric 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 held tone shows up in score_breakdown as its own event. Here is what the example call returns:
{
"eligible_turns": 4,
"turns_with_events": 1,
"events": [
{
"type": "held_tone",
"turn": 5,
"role": "assistant",
"offset_seconds": 1.48,
"duration_seconds": 1.52,
"start_time": 14.98,
"mark": "range",
"timing_source": "turn_timestamps",
"description": "A tone was held for 1.5s",
"position": "middle",
"pitch_hz": 388.0,
"periodicity": 0.993,
"level_dbfs": -18.0,
"jitter": 0.0,
"glide": 0.0,
"hold_ratio": 7.6,
"pitch_ratio": 1.7,
}
],
"skipped": [],
}| Field | What it means |
|---|---|
pitch_hz | The tone's pitch |
periodicity | How regular the sound is, from 0 to 1. A pure tone is close to 1 |
level_dbfs | How loud the tone is |
jitter | How much the pitch wobbles from one 40 ms frame to the next, as a share of the pitch |
glide | How far the pitch drifts from the start of the tone to its end, as a share of the pitch |
hold_ratio | How many times longer the tone is than the agent's typical held sound |
pitch_ratio | How many times higher the tone is than the agent's usual pitch |
position | Whether the tone is near the start, middle or end of the clip |
Clips 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 counted and turns_with_events how many had a held tone. The score is the share that had none.
How Is It Calculated?
The HeldToneMetric score is calculated according to the following equation:
Held tone criteria
A voice holding a vowel wobbles and drifts in pitch. A stuck tone doesn't.
A stretch is a held tone when it holds one steady pitch:
| Check | Rule |
|---|---|
| Length | At least 0.8 seconds |
| Pitch | Between 60 and 1000 Hz |
| Regular | Periodicity at least 0.85 |
| No wobble | Jitter at most 0.2% of the pitch |
| No drift | Glide at most 1% of the pitch |
and it stands out from the agent's own voice in at least one way:
| Check | Rule |
|---|---|
| Held too long | At least 3 times the agent's typical held sound |
| Too high | At least 1.3 times the agent's usual pitch |
| Long outright | At least 2.5 seconds |
The agent's typical held sound and usual pitch come from all of its clips in the call, so a slow speaker sets their own baseline.
If there's nothing to count, the metric is skipped.
Example call
A call where the agent holds a vowel in one reply and plays a steady beep in another.
| Agent turn | What happens | Held tone? |
|---|---|---|
| 1 | Normal speech | No |
| 3 | A 1 s vowel whose pitch drifts down | No |
| 5 | A 1.5 s beep at 388 Hz, far higher than the agent's voice | Yes |
| 7 | Normal speech | No |
| 4 replies | 1 held tone → 3/4 = 0.75 |