Analyze the harmony of music
theory_analyzeAnalyze MIDI, project, audio, inline notes, or chord labels to identify key changes, chords, Roman numerals, cadences, phrases, rhythm, and motifs; undetermined readings are reported.
Instructions
Analyses a .mid file, a project file, an audio file, inline notes or chord labels: the key (with runner-up readings), key changes, the chord per segment, Roman numerals, cadences, phrases, a reduced progression, the rhythm and recurring motifs, each with the library's rationale; a reading that cannot be made is reported as undetermined. Audio gives the chord-level aspects only (from its key and chord estimates); for its notes, transcribe it with audio_transcribe first. Positions are quarter notes (_ppq). Not for one chord, scale or interval fact (use theory_lookup) or for rule checks (use theory_check). Example: {"chords": [{"symbol": "C", "start_ppq": 0, "end_ppq": 4}, {"symbol": "G7", "start_ppq": 4, "end_ppq": 8}, {"symbol": "C", "start_ppq": 8, "end_ppq": 12}], "aspects": ["key", "roman", "cadences"]}.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "theory_analyze"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| key | No | Key to analyze in, e.g. 'C major', 'A minor', 'D dorian'. Omit to detect it. | |
| limit | No | Maximum rows per long list (chords, roman, reduction); 1-1000. | |
| chords | No | Chord labels [{symbol, start_ppq, end_ppq}] instead of a source, analyzed as a progression; each chord lasts until the next one starts. Give either source or chords. | |
| detail | No | 'concise' returns the summary and the most useful fields; 'full' returns all. | concise |
| offset | No | Index of the first row of the long lists (chords, roman, reduction). | |
| source | No | An audio file, a .mid file, a project file (.sonare.json) or inline tracks [{name?, program?, channel?, is_drum?, notes: [{pitch, start_ppq, length_ppq, velocity}]}]. Drum notes are ignored. Audio gives chord-level aspects only. Give either source or chords. | |
| aspects | No | What to analyze: key, modulations, chords, roman, cadences, phrases, reduction, rhythm, motifs (omitted: key, chords, roman, cadences). modulations, rhythm and motifs need notes. | |
| alternatives | No | Also return runner-up key readings and chord readings. | |
| time_signature | No | Time signature {numerator, denominator}. Omit to read it from the source (the first one of a .mid or project; libcantus assumes 4/4 for inline input). |