Add per-note velocity routing to filter cutoff and resonance

This commit is contained in:
Armin 2026-08-30 00:01:53 +02:00
commit 9ef77e04ab
6 changed files with 63 additions and 20 deletions

View file

@ -106,6 +106,8 @@ Osc1 + Osc2 → Amplitude Envelope × Velocity → Filter (cutoff modulated by F
| filterRes | Filter Res | 0..1 | 0.3 |
| filterEnvAmt | Filter Env Amt | 0..1 | 0 |
| keyTrack | Key Tracking | 0..1 | 0.5 |
| velToCut | Vel → Cutoff | 0..1 | 0 |
| velToRes | Vel → Resonance | 0..1 | 0 |
| fEnvAttack | Filter Attack | 0.001..5 (log) | 0.01 |
| fEnvDecay | Filter Decay | 0.001..5 (log) | 0.3 |
| fEnvSustain | Filter Sustain | 0..1 | 0.5 |
@ -198,6 +200,12 @@ ChromaFlockEditor (juce::AudioProcessorEditor)
### Filter Crash Fix
`SubtractiveVoice` now has separate `filter` (L) and `filterR` (R) instances; `startNote()` prepares both. Resolves the state-sharing crash when filter env amount > 0.
### Per-Note Filter Velocity Routing
- `VEL CUT` (`velToCut`) and `VEL RES` (`velToRes`) knobs map each note's velocity to filter cutoff / resonance. Velocity is the only per-note MIDI data a DAW sequencer sends, so cutoff & resonance become drawable per note in the DAW's piano-roll velocity lane — no built-in step sequencer added.
- Cutoff path is envelope-independent: `modCutoff *= 2^(velToCut * noteVelocity * 4)` (up to +4 octaves at full depth/velocity). Resonance: `res * (1 + velToRes * noteVelocity)`, clamped to 0..1.
- Works through the arpeggiator (held-note velocities are forwarded) and the plugin's own piano roll (sends 0.8).
- FILTER section layout: type dropdown moved into the header row, knobs now a 3x2 grid (CUTOFF/RES/ENV AMT over KEY TRK/VEL CUT/VEL RES).
### Arpeggiator
- New class `DSP/Arpeggiator.h` — tempo-synced, pure note-logic (no audio). Tracks held notes (press order for the As Played pattern), builds a pitch pool from held notes × octave range (13, clamped to MIDI range), and sequences it per pattern.
- Patterns: Up, Down, UpDown, DownUp, Random, As Played, Chord, Up&Down X, Down&Up X, Random Once, Octave Up, Octave Down, Pinky Up, Pinky Down. X variants are endpoint-exclusive bounces; Random Once shuffles per cycle (no repeat until full pass); Octave Up/Down play each root followed by its ±12 copies spanning the selected OCTAVES count; Pinky Up/Down alternate extremes low/high. Up arpeggiate a minor third + fifth (root, +3, +7) and the Up major variant a major third + fifth (root, +4, +7); UpDown/DownUp arpeggiate major (root, +4, +7) plus an UpDown minor variant (root, +3, +7), each as a separate step. Dropdown labels: "Up / Minor", "Down / Minor", "Up & Down / Major", "Down & Up / Major", "Up / Major", "Down / Major", "Up & Down / Minor". "Down" patterns always descend from each held note through the chord tones below it (root, fifth below, third below, next-octave root — e.g. C3, G2, E2, C2 for major), never playing above the held note; any harmony pattern does the same when DIR is set to Down. C3/C4 1/2/3 anchor to the most recently held key and play fixed 8-step loops alternating it and its octave above (3-3-4-3-4-3-3-4, 4-3-3-3-3-3-3-3, 3-3-3-4-3-3-3-3).