mcp_opendaw_detect_scale_from_notes
Analyse MIDI notes to detect the musical scale or key. Uses pitch class distribution to match 15 scales and returns best match, alternatives, and confidence rating.
Instructions
Detect the musical scale/key from MIDI notes in a region.
Analyses the pitch class distribution of all notes in a region and matches it against 15 common scales using Pearson correlation. Unlike detect_key (which works on WAV audio), this works directly on MIDI note data — no audio file needed.
Scales tested (15):
major, natural_minor, harmonic_minor, melodic_minor
dorian, phrygian, lydian, mixolydian, locrian
pentatonic_major, pentatonic_minor, blues
hungarian_minor, double_harmonic, whole_tone
Returns:
best_match: {scale, root, correlation} — highest scoring scale
alternatives: top 5 matches with correlation scores
pitch_class_histogram: 12-bin histogram of note pitches
note_count: total notes analysed
chromatic_coverage: how many of 12 pitch classes are used
confidence: qualitative rating (high/medium/low based on correlation)
Use this before:
force_scale_notes (to know which scale to force)
diatonic_transpose_notes (to know the correct scale)
generate_melody (to match existing material's scale)
reharmonize_progression (to pick the right key)
unit_index: AU index. track_index: Note track index. region_index: Region index (-1 = first region, -2 = all regions on track).
Example: scale = detect_scale_from_notes(0, 0)
best_match: {scale: "natural_minor", root: "A", correlation: 0.87}
→ use force_scale_notes(root="A", scale="natural_minor")
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| unit_index | Yes | ||
| track_index | Yes | ||
| region_index | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |