Skip to content

The Algo-Rhythm

How CLARA turns a melody into a full arrangement — no AI, no guesswork, just music theory

Every arrangement CLARA produces is deterministic. Give it the same melody, the same style, the same key — and you'll get the same result every time. There are no neural networks, no language models, no randomness. Instead, CLARA encodes the patterns that human arrangers have refined over centuries into concrete algorithms. The goal isn't to replace the arranger's art, but to make that craft accessible to anyone with a melody and a need.

1

Read the Score

CLARA accepts MusicXML, MIDI, and ABC notation. It parses the input into an internal representation using music21, the MIT music analysis library. From the raw notes, it extracts the key signature, time signature, and — most importantly — the melody.

2

Analyze the Harmony

Beat by beat, CLARA determines the underlying harmony using Roman numeral analysis. It identifies which chord fits each moment — I, IV, V, vi, and all their cousins — by examining the melody's pitch against the key. It also detects phrase boundaries, cadence points, and metric emphasis (strong vs. weak beats), because where you are in the phrase matters as much as what chord you're on.

3

Enrich the Harmony

Raw Roman numerals are a starting point. The enrichment layer adds color: secondary dominants (V/V, V/vi), applied chords, and cadential formulas appropriate to the style. A gospel arrangement gets dominant 7ths and tritone substitutions. A Bach chorale gets suspensions and passing tones. An impressionist setting gets added 9ths and modal interchange. Each style has its own harmonic vocabulary.

4

Apply the Pattern

This is where each style comes alive. CLARA has 18 distinct arrangement patterns, each a self-contained algorithm that translates harmony into piano texture. The hymn-block style places close-position triads in the right hand over root-fifth bass. The gospel style plays stride: bass notes on strong beats, mid-register 7th chords on weak beats. Lieder rolls arpeggios in the manner of Schubert. Every style generates a right-hand part and a left-hand part, note by note, measure by measure.

5

Voice Leading & Playability

Raw chord progressions can sound choppy if voices jump around. CLARA's voicing engine minimizes motion between consecutive chords — common tones are retained, other voices move by the smallest interval possible. It checks for (and avoids) parallel fifths and octaves, enforces hand-span limits (no wider than a minor 10th), and ensures the result is physically playable. For vocal harmonizations, it enforces proper SATB ranges and detects voice crossings.

6

Dynamics, Pedaling & Polish

The final layer adds musicality. CLARA shapes dynamic arcs across phrases — growing toward phrase climaxes, pulling back at cadences. It adds sustain pedal markings appropriate to the style (legato pedaling for romantic works, none for organ or shape-note). Tempo markings, articulations, and expression marks are placed based on the style's conventions. The result is a score that doesn't just have the right notes, but feels like music.

Beyond the Piano

Ensemble Orchestration

The same harmonic analysis feeds an orchestration engine that distributes voices across string quartets, wind quintets, brass quintets, piano trios, and custom ensembles. Each instrument gets idiomatic writing — double stops for violin, arco/pizzicato for cello, transposed parts for Bb clarinet and F horn — informed by statistical analysis of the OpenScore quartet corpus.

Vocal Harmonization

CLARA generates four-part SATB or three-part SAB harmony from a single melody line. Voice ranges are strictly enforced (Soprano C4–G5, Alto F3–D5, Tenor C3–G4, Bass E2–D4), parallel fifths and octaves are detected and corrected, and voice crossings are resolved. The result follows the same rules taught in any university counterpoint class.

Piano Reduction

Working in reverse, CLARA can take an ensemble or orchestral score and reduce it to playable two-hand piano. It chordifies all parts, removes octave doublings, identifies melody and bass lines, and enforces per-hand span limits. Three difficulty levels — concert, intermediate, and simplified — control how many voices are preserved.

Solo Transcription

A Bach cello suite for flute? A violin partita for trombone? CLARA adapts solo works between instruments by analyzing range, transposing intelligently, translating idiomatic techniques (pizzicato becomes tongue-stop, double stops become grace notes), and adjusting articulations to suit the target instrument's character.

CLARA is built with Python, music21, and Flask. Every arrangement is generated in real time — no pre-computed results, no lookup tables. The entire codebase is tested against 815 automated tests covering voice leading, playability, style correctness, and output quality.

API Documentation →