Jazz Enclosures with the JolyMusic Generator: Target, Render, Export
A professional workflow for using the JolyMusic Enclosure Generator: choose harmonic targets, compare chromatic and diatonic approaches, read the generated OSMD score, then export or save useful MIDI lines.
Published May 29, 2026, 4:48 AM
A professional workflow for using the JolyMusic Enclosure Generator: choose harmonic targets, compare chromatic and diatonic approaches, read the generated OSMD score, then export or save useful MIDI lines.
A jazz enclosure is a compact way to make a target note sound earned. Instead of playing the chord tone directly, the line approaches it from above, below, or both sides, then resolves into the note that explains the harmony. Used well, an enclosure is not decoration. It is a target-tone system.
The JolyMusic Enclosure Generator is built around that system. The Symfony page controller prepares tone models, key options, default octave data, export permissions, and the save endpoint; the Stimulus controller turns those inputs into rendered practice lines with note roles, enclosure units, contour chips, OSMD notation, playback, pagination, MIDI download, and optional library saving.
Start where the controller starts: target data
The page action for app_tool_enclosure does not render a static lesson. It queries the tone table for pitch names, MIDI values, frequency, color, and solfege, then chooses C as the default tone when possible. It also loads key select rows through the key repository and prepares a default key id for the key selector. That matters pedagogically: the generator is not guessing note names. It is working from the same tonal data model used by the rest of JolyMusic.
For practice, this means the first musical decision should be as explicit as the controller state: pick the key, then pick the target degree. The UI exposes root, third, fifth, seventh, ninth, and all-scale targets. Those are not decorative labels; they decide which tones the generated lines are allowed to resolve into.
| Target degree | Best use | Listening check |
|---|---|---|
| Root | Stabilize beginner practice and key-center hearing | The line sounds finished but can become predictable |
| Third | Define major, minor, and dominant quality | The chord color becomes clear on arrival |
| Fifth | Build neutral vocabulary without too much color | The line resolves cleanly without strongly naming the chord type |
| Seventh | Practice guide-tone voice leading | The line points toward the next harmony |
| Ninth | Add melodic color above basic chord tones | The target sounds lyrical, not accidental |
| All scale | Generate broader inside vocabulary | Every target still needs a clear phrase ending |
Chromatic and diatonic are different algorithms for pressure
The controller passes the selected neighbor mode to buildEnclosureLines. In chromatic mode, the approach tones are tight half-step neighbors. In diatonic mode, the approach tones are drawn from the selected key-scale context when available. Both modes can produce useful vocabulary, but they answer different musical questions.
A chromatic route into E might use F and Eb before landing on E. A diatonic route in C major might use F and D before landing on E. The target is the same, but the pressure is different: chromatic motion creates bebop bite, while diatonic motion keeps the line inside the key or mode.
| Target | Chromatic enclosure | Diatonic enclosure in C | Effect |
|---|---|---|---|
| E over Cmaj7 | F - Eb - E | F - D - E | Outside bite versus inside release |
| B over G7 | C - Bb - B | C - A - B | Dominant pressure into the third |
| G over Cmaj7 | Ab - F# - G | A - F - G | Strong pull versus scale-based approach |
Use beginner patterns, then expert variants
The beginner pattern select is populated by the Stimulus controller from the enclosure model. It gives clear shapes such as upper-target, lower-target, upper-lower-target, lower-upper-target, double neighbors, turns, and mixed chromatic-diatonic variants. The expert-pattern select is separate because advanced variants can create dense lines quickly. That separation is good practice design: learn the function first, then increase vocabulary.
Presets make this faster. Basic upper-lower and lower-upper presets are for clean target hearing. Chromatic bebop and double chromatic presets are for stronger tension. Diatonic inside keeps the line closer to the key. Turn style is useful when the target should feel embedded inside a melodic ornament rather than announced by a simple two-note approach.
Harmony targeting makes diatonic practice serious
The advanced harmony-targeting panel is lazy-loaded from app_tool_enclosure_keyscale_selector. It uses the shared key-scale selector component, keeps a small local history, filters toward scales, and sends key-scale change events back to the enclosure controller. When a scale is selected, the controller stores root pitch class, pitch classes, target tones, and interval colors. The next generated line can then distinguish diatonic approach notes from chromatic tension.
That is the difference between a toy generator and a practice tool. If you study D Dorian, G altered, or C major, the generator can reflect the selected scale material instead of treating every target as an isolated pitch. Use this panel when you want the line to answer a harmonic situation, not just a note-name exercise.
Read the generated card like a professional
Each generated line card contains more information than a note list. The header shows the localized line label, key signature, time signature, note length, and tempo. The body separates generated notes, enclosure units, melodic contour, and a legend for approach notes, diatonic approach notes, chromatic tension, and target resolution. The embedded OSMD score is generated from the same line data, with target note color applied for visual confirmation.
Before playing, read the role colors. Before exporting, inspect the contour chips. If the line sounds awkward, the problem is usually visible: too much chromatic pressure, the wrong target degree, a note length that does not fit the phrase, or an octave setting that pushes the line away from the instrument range you actually practice.
| Result area | What it verifies | What to change if it fails |
|---|---|---|
| Generated notes | The target and approach notes are readable | Target degree or neighbor mode |
| Enclosure units | The cell structure is clear | Pattern or expert variant |
| Contour chips | The line moves in a playable shape | Octave or pattern length |
| OSMD score | The notation fits the selected meter and rhythm | Note length, tempo, or time signature |
Export and save are part of the design
The page controller sets canExportGeneratedFiles for fully authenticated users and canSaveGeneratedFiles for users with write access. The UI mirrors that: MIDI download buttons are disabled until export is allowed, and cloud save buttons require the paid write permission. This makes the tool useful for both quick browser practice and a larger media-library workflow.
When saving, the Stimulus controller posts JSON to the enclosure save endpoint. The payload includes the MIDI base64 data, title, audience, visibility, BPM, pattern, neighbor mode, octave, metadata, and a track container when enabled. That track container marks target notes and includes piano-roll-ready timing, so a saved enclosure is not just a file; it can become editable practice material elsewhere in the app.
A complete twenty-minute practice block
- Minutes 0-3: Select C, target the third, choose upper-lower-target, and generate chromatic lines at eighth notes.
- Minutes 3-6: Play the first four lines. Say the target before pressing play.
- Minutes 6-9: Switch neighbor mode to diatonic and compare the role colors and sound.
- Minutes 9-12: Change the target to seventh and listen for guide-tone function.
- Minutes 12-15: Open harmony targeting and select a scale context for the same key.
- Minutes 15-18: Move the key and keep the same pattern. Do not change everything at once.
- Minutes 18-20: Export or save only one line you can sing without looking.
Professional mistakes to avoid
| Mistake | What the tool shows | Correction |
|---|---|---|
| Choosing all-scale too early | Many lines, weak target discipline | Start with third or seventh |
| Exporting before reading the card | MIDI files with unclear role structure | Check note roles, units, contour, and OSMD first |
| Changing key, target, pattern, and rhythm together | No clear cause when the line fails | Change one control per pass |
| Using chromatic mode for every style | Every phrase has the same outside bite | Use diatonic mode with harmony targeting for inside contexts |
| Ignoring permissions | Disabled export or save controls | Log in for download; use write access for library save |
A strong enclosure practice session ends with fewer lines, not more. The generator can create pages of material, but the professional goal is to identify one line whose target is audible, whose role colors make sense, whose notation reads cleanly, and whose MIDI is worth saving.