Recipe catalog / passage-difficulty
Grade the difficulty of a musical passage
passage-difficulty is a Jev recipe from the jev-recipes TypeScript package. How hard is the passage described in passage for a player of instrument, from beginner to virtuoso? Use it when you are building a practice app, lesson planner, or repertoire search and need to grade described passages or pieces so they can be matched to a player's level.
Last updated .
Explore this recipe interactively · Source and implementation guide · Markdown version
How do I use passage-difficulty 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 { passageDifficulty } from 'jev-recipes/passage-difficulty';
const result = await passageDifficulty({
"passage": "Continuous sixteenth-note arpeggios across all four strings at quarter note = 144, in E-flat major, moving from first position up to seventh position and back every two bars, with string crossings on every beat and a two-octave leap into the final bar.",
"instrument": "violin",
"minConfidence": 0.8
});
console.log(result);
What input does passage-difficulty take?
| Field | Type | Needed |
|---|---|---|
| passage | string | Required |
| instrument | string | Optional |
| minConfidence | number | Optional |
Full input and result schemas
{
"input": {
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"properties": {
"passage": {
"type": "string"
},
"instrument": {
"type": "string"
},
"minConfidence": {
"type": "number",
"minimum": 0,
"maximum": 1
}
},
"required": [
"passage"
]
},
"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
}
},
"difficulty": {
"type": "string",
"enum": [
"beginner",
"easy",
"intermediate",
"advanced",
"virtuoso"
]
}
},
"required": [
"model",
"usage",
"status",
"score",
"level",
"confidence",
"probabilities",
"difficulty"
],
"additionalProperties": false
}
}What does a passage-difficulty 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 passage-difficulty.
{
"model": "demo-fixture",
"usage": {
"input_tokens": 0,
"output_tokens": 0
},
"status": "ready",
"score": 2.95,
"level": 3,
"confidence": 0.84,
"probabilities": {
"0": 0,
"1": 0.01,
"2": 0.09,
"3": 0.84,
"4": 0.06
},
"difficulty": "advanced"
}
Input
See shared options and behavior for client configuration, validation, and errors. Types are inferred from this folder's Zod 4 schemas. instrument is optional and is omitted from the request when absent.
Result
difficulty is one of beginner, easy, intermediate, advanced, virtuoso, 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 comes from the description alone, so a passage described without tempo, key, or range is graded on what is stated, and a vague description tends toward the middle of the scale rather than a confident extreme. Difficulty is judged relative to typical players of the named instrument, not to a particular student, and the same passage can grade differently on different instruments. Assigning the grade to a level system, choosing repertoire for a specific student, and deciding when a player is ready to move up belong in application code or a teacher.
Example input
demo.json contains editable input and a hand-authored response. After installing jev-recipes, npx jev-recipes demo passage-difficulty shows an offline illustration, not an accuracy measurement. Use npx jev-recipes describe passage-difficulty to inspect the input and result schemas.
How accurate is passage-difficulty?
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 passage-difficulty?
- Grades the passage as described in text, not from a score or recording. Tempo, key, range, and technique count only when the description states them.
- Difficulty is relative to typical players of the named instrument; when instrument is omitted the grade assumes whatever instrument the description implies.
- Does not know a particular student's level. Matching a grade to a player belongs in application code.
Which recipes are related to passage-difficulty?
- task-complexity: Use task-complexity to grade how involved a general task is, rather than how hard a musical passage is to play.
- audience-fit: Use audience-fit to check whether content suits a described audience, rather than to place a passage on a difficulty scale.