Recipe catalog / tension-level
Grade harmonic tension
tension-level is a Jev recipe from the jev-recipes TypeScript package. How much harmonic tension does the current point in progression carry, from fully resolved to a peak demanding resolution, given any key supplied? Use it when a generation loop or accompaniment engine wants to know whether the harmony is at rest, building, or begging for resolution, so it can decide whether to release, hold, or push further.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use tension-level in TypeScript?
Install with npm install jev-recipes. Requires Node.js 22.9 or newer and ES modules. Set TYPESAFE_API_KEY in your server environment for live calls, which send input to TypeSafe and use API quota. See the installation guide.
import { tensionLevel } from 'jev-recipes/tension-level';
const result = await tensionLevel({
"progression": "Am - F - Dm7 - G7 - G7(b9) with the melody suspended on C over the bass, held for two full bars and swelling (current chord)",
"key": "C major",
"minConfidence": 0.8
});
console.log(result);
What input does tension-level take?
| Field | Type | Needed |
|---|---|---|
| progression | string | Required |
| key | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"progression": {
"type": "string"
},
"key": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"progression"
]
},
"result": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"model": {
"type": "string"
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"output_tokens": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
}
},
"required": [
"input_tokens",
"output_tokens"
],
"additionalProperties": false
},
"status": {
"type": "string",
"enum": [
"ready",
"review"
]
},
"score": {
"type": "number",
"minimum": 0
},
"level": {
"type": "integer",
"minimum": 0,
"maximum": 9007199254740991
},
"confidence": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"probabilities": {
"type": "object",
"propertyNames": {
"type": "string"
},
"additionalProperties": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"tension": {
"type": "string",
"enum": [
"resolved",
"low",
"moderate",
"high",
"peak"
]
}
},
"required": [
"model",
"usage",
"status",
"score",
"level",
"confidence",
"probabilities",
"tension"
],
"additionalProperties": false
}
}What does a tension-level result look like?
This hand-authored response demonstrates the contract. It is not a model accuracy measurement. Run it without an API key: npx jev-recipes demo tension-level.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"score": 3.76,
"level": 4,
"confidence": 0.83,
"probabilities": {
"0": 0.01,
"1": 0.01,
"2": 0.02,
"3": 0.13,
"4": 0.83
},
"tension": "peak"
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas. key is optional and is omitted from the request when absent.
Result
tension is one of resolved, low, moderate, high, peak, taken from the most likely rubric level. level is that level's index from 0 to 4. score is Jev's expected value across the rubric and can fall between levels; use it for ranking or thresholds where a single label loses information.
A result is ready when confidence meets minConfidence. Otherwise it is review and still carries the graded values for inspection. probabilities is keyed by level index.
Reuse and calls
Uses the shared score helper. This folder owns the question, the rubric wording, and the review policy. A live invocation makes one logical Jev request.
Limits
The grade is a judgment of harmonic pull from chord symbols and annotations, not a theory analysis: identifying the key, computing scale degrees, and reading tension out of a specific voicing are exact questions for application code, which should state the results in progression when they matter. Tension is heard relative to a style, so a dominant seventh that is high in a chorale can be low as the home chord of a blues; describe the style in the text when it would change the reading. The grade says how much the harmony pulls, not what to play next; whether to release, hold, or push further is the caller's decision.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo tension-level shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe tension-level to inspect the input and result schemas.
How accurate is tension-level?
No verified live accuracy measurement is available. Evaluate representative cases before using this decision in your workflow.
Use the evaluation guide to measure this decision on your own labeled cases.
What are the limits of tension-level?
- Grades the tension implied by chord symbols and annotations at the last point in progression. It does not analyze voicings, compute scale degrees, or identify the key; supply key and describe suspensions or holds in the text.
- Tension is heard relative to a style; a dominant seventh that demands resolution in a hymn is a resting chord in a blues. State the style in the text when it matters.
- The grade is not a decision about what to play next.
Which recipes are related to tension-level?
- urgency-signal: Use urgency-signal to detect an explicit request for urgent attention in a message, not the pull of an unresolved chord.
- step-progress: Use step-progress to judge whether a new observation advances a task objective, rather than how far a harmony is from its home chord.