Add diatonic chord entry and velocity control

Chords are built by stacking scale thirds rather than from a quality table,
so the chord follows the degree automatically -- in C major, Alt+3 on C gives
C major, on D gives D minor, on B gives B diminished. Toggling delegates to
toggleCell, so chord tones inherit hold-mode joining, splitting and trimming
unchanged.

Velocity keys act on the note under the cursor if there is one, and on the
default for new notes otherwise, announcing which. That avoids a mode switch
between setting a level to draw at and shaping dynamics after the fact.

Also fixes install.ps1 failing to resolve its own directory: $PSScriptRoot is
not reliably populated during parameter binding, so it is resolved in the body.

Tests cover chord quality per scale degree and range clamping.
This commit is contained in:
2026-08-14 18:18:12 +02:00
parent 8fd6f947ed
commit c9e927ca3d
8 changed files with 214 additions and 3 deletions
+40
View File
@@ -72,6 +72,9 @@ actions by hand in Actions → Show action list. That always works.
| `Left` / `Right` | Cursor back / forward one grid cell | OSARA previous / next chord |
| `Up` / `Down` | Pitch up / down one scale degree | OSARA higher / lower note in chord |
| `Enter` | Toggle note at cursor cell | Edit: Event properties |
| `Alt+3` | Toggle diatonic triad on cursor pitch | — |
| `Alt+7` | Toggle diatonic seventh chord | — |
| `Alt+Shift+Up` / `Alt+Shift+Down` | Velocity up / down | — |
| `Alt+G` | **Toggle grid mode on/off** | — |
| `Alt+H` | Toggle hold mode | — |
| `Alt+A` | Repeat current cell (speak + sound) | — |
@@ -112,6 +115,42 @@ it into one sustained note. Toggling a cell off in the middle of a sustained
run splits it in two; at either end, it shortens it. So you can draw a long
note by arrowing right and pressing Enter across several cells.
## Chords
`Alt+3` stamps a **diatonic triad** on the cursor pitch; `Alt+7` a seventh
chord. Both are built by stacking scale thirds, so the quality follows the
degree automatically — in C major, `Alt+3` on C gives C major, on D gives D
minor, on B gives B diminished. There is no chord-quality table to configure
and no way to land on a chord outside the key.
If every tone of the chord is already in the cell, the keystroke removes them
all; otherwise it fills in whatever is missing. Chord tones obey hold mode,
splitting and trimming exactly like single notes.
You can also build chords by hand at any time — arrow to a pitch, press Enter,
arrow to another, press Enter. The cursor never moves horizontally when you
toggle, so stacking notes in one cell has always worked. `Alt+3` and `Alt+7`
are just the one-keystroke version.
In the chromatic scale, "stacking thirds" degenerates into stacked whole
tones. Predictable, but not musically useful — pick a real scale first.
## Velocity
`Alt+Shift+Up` and `Alt+Shift+Down` change velocity in steps of 8.
The key does one of two things depending on where you are, and says which:
- **On a note** — changes that note's velocity: *"E5 velocity 104"*, and
replays it at the new level so you can hear the change.
- **On an empty cell** — changes the default for newly inserted notes:
*"Default velocity 104"*.
So you can set a level and then draw at it, or draw first and shape the
dynamics afterwards, without a mode switch either way.
Set `velstep` in `ExtState` if steps of 8 are too coarse or too fine.
## Scales
`Alt+S` prompts for a root (`C`, `F#`, `Bb`…) and a scale number. Up and down
@@ -145,6 +184,7 @@ In `ExtState` section `midigrid`:
| Key | Default | Meaning |
|---|---|---|
| `vel` | 96 | Velocity of inserted notes |
| `velstep` | 8 | Velocity change per keypress |
| `chan` | 0 | MIDI channel (0-based) |
| `previewdur` | 0.4 | Preview note length, seconds |