Abrupt Pitch Jump
The abrupt pitch jump metric checks whether your voice agent's voice cracks or squeaks: a sudden leap up in pitch, faster than a human voice can move and above the voice's usual range. It returns the share of agent replies without one, between 0 and 1.
Required Arguments
To use the AbruptPitchJumpMetric, you'll have to provide a ConversationalTestCase with:
audioon the agent's turns, one clip per reply, 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 AbruptPitchJumpMetric() 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 AbruptPitchJumpMetric
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 = AbruptPitchJumpMetric(threshold=0.8)
evaluate(test_cases=test_cases, metrics=[metric])There are TWO optional parameters specific to the AbruptPitchJumpMetric, on top of the common voice metric parameters:
- [Optional]
eval_mode:"deterministic"or"hybrid". In"hybrid", each candidate jump is heard 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 toHumeDecisionModel().
The jump limits are fixed, since a crack is a defect, not a matter of taste.
As a standalone
You can also run the AbruptPitchJumpMetric 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 pitch jump 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": "pitch_jump",
"turn": 3,
"timing_source": "turn_timestamps",
"description": "Pitch jumped abruptly to 6 semitones above the voice's usual range",
"pitch_hz": 365.4,
"offset_seconds": 0.96,
"duration_seconds": 0.08,
"start_time": 9.46,
"mark": "moment",
}
],
"skipped": [{"turn": 9, "error": "Reply has no voiced speech."}],
}| Field | What it means |
|---|---|
offset_seconds | Where the jump is, in seconds from the start of the turn's clip: the 40 ms just before the step |
duration_seconds | Always 0.08: the 40 ms either side of the step |
pitch_hz | The pitch the voice jumped to, in Hz. Only in the "deterministic" eval mode |
Only the step up counts, so a crack that goes up and comes back down is one event. Replies with no voiced speech, or audio 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 at least one jump. The score is the share that had none.
How Is It Calculated?
The AbruptPitchJumpMetric score is calculated according to the following equation:
The metric reads per-turn audio, one agent clip at a time, or replies cut from stereo full call audio when no turn has audio. The caller's turns are never checked. A reply counts as having a jump at most once, however many it has.
Which replies are scored
The metric tracks the pitch of every 40 ms of the clip, between 70 and 500 Hz, and leaves out stretches that are near silent or have no clear pitch (such as "s" or "f" sounds). What's left is the voiced speech. A reply is scored if it has any.
Pitch jump criteria
A jump is a step in pitch from one 40 ms frame to the very next one:
| Check | Rule |
|---|---|
| Step size | 6 semitones or more, between the steady pitch before and the steady pitch after |
| Steady before | At least 5 frames (200 ms), each within 3 semitones of the one before |
| Steady after | At least 5 frames, the same way |
| No gap | The two frames are back to back, with no unvoiced frame between |
| Above the usual range | The pitch it lands on is at least 1 semitone above the top of the voice's usual range: the pitch the agent's voice stays under 95% of the time, across all its replies on the call |
A 6-semitone step in 40 ms is 150 semitones a second, about 2.5 times the fastest pitch change a speaker can make on purpose. The last check keeps only steps up and out of the voice's range. Inside the range, a step is how the voice normally moves, and a step down, such as the crack coming back, never lands above the range.
If no agent reply has voiced speech, the metric is skipped.
Second check
In the hybrid eval mode, the metric casts a wider net and lets the audio decision model decide. A stressed word steps up just like a crack does, and only a listener can tell them apart. So instead of the rules above, every step up of 6 semitones or more that holds for 120 ms and lands in the top tenth of the voice's range is a candidate. The model hears about 5 seconds of the agent's audio around each one, from the full call audio when there is one, otherwise from the turn's own clip, and is asked:
Does the speaker's voice suddenly jump to a different pitch, as if it glitched or cracked?
If the model judges "no" more likely than "yes", the candidate is dismissed and doesn't count against the score. Candidates the model keeps are reported with the description "Pitch jumped abruptly" and no pitch_hz. If the model can't be reached, only candidates the rules above would flag still count.
Example call
A call with five agent replies: one cracks up for 400 ms, one dips down for 400 ms, and one is silent. Each row is one agent reply and whether it had a jump.
| Agent turn | What happens | Jump? |
|---|---|---|
| 1 | Normal speech | No |
| 3 | Held vowel leaps up 8 semitones, to 365 Hz, at 1.0 s and comes back down at 1.4 s | Yes (1 event, for the step up) |
| 5 | Held vowel drops 8 semitones at 1.0 s and comes back up at 1.4 s | No, it never goes above the usual range |
| 7 | Steady held vowel | No |
| 9 | Silence, no voiced speech | Skipped |
| 4 replies | 1 with a jump → 3/4 = 0.75 |
FAQs
How is this different from pitch variation?
Can it miss a crack?
"hybrid" eval mode, shorter steps up are also sent to the audio decision model.Does this metric call an LLM or an external speech model?
"hybrid" eval mode, each candidate jump is checked by an audio decision model, at one paid request per candidate.