- NoteOn: durationMs=60000 (1 phút, giữ cho đến khi NoteOff)
- NoteOff: stopNote(ch, pitch) gọi synthInstance.noteOff() ngay
- MIDI channel (msg.data[0] & 0x0F) truyền đúng vào playNote
- CC (sustain/modulation) + pitch bend forward qua SpessaSynth
- Add controllerChange forwarder for all CC messages (cmd 0xB)
- Add pitchBend method to SonicSF + MIDI handler (cmd 0xE)
- CCs routed to _synthInstance.controllerChange(ch, cc, val)
- Pitch bend routed to _synthInstance.pitchBend(ch, 14bit-val)
- Remove small Synth button (already done earlier)
- Large Synth button now calls openInstrumentSelector (instrument modal)
- Fix _initPromise stale cache: reset to null when init fails
- Module not loaded yet → retries on next select instead of stuck
- openInstrumentSelector builds flat list of all instrument presets
- Modal shows all instruments with search bar
- Each preset shows sf name + program name
- Remove old two-step (SF list -> presets) navigation
- Fix pre-existing closing paren mismatch in PluginManagerModal
- catalog keys are lowercased (soundfont_inspector: .lower())
- sf.id from _scan_soundfonts has original case (SGM_v2.01)
- Use catalog[sfId.toLowerCase()] || catalog[sfId] to match both
- _scan_soundfonts: dict-keyed by base_id to prevent duplicates
- Add 'source' field ('system' | 'upload') to each soundfont entry
- Delete endpoint: only allow deleting upload soundfonts (403 for system)
- Frontend: show (system)/(upload) tag, hide Delete for system fonts
- App startup fetches full catalog with all instrument presets
- Merges presets into instrumentSelectorData.soundfonts
- Synth button shows presets from cache (no per-SF API call)
- Fallback: if cache miss, fetch individual SF presets on demand
- Remove setSelectionStart/End from simple click (non-drag) path
- Only handleMouseMove (drag) creates/modifies selection
- Sub-tab already correct (no selection set on click)
- Time Ruler click → setSelectionFollowsTempo(false) → time-based
- Tempo Track Lane click → setSelectionFollowsTempo(true) → tempo-based
- Also handles sub-tab ruler (EDITOR tabs)
- Manual toggle button ♪T/⏱T still works for override
- WaveformLane bar grid: integer beat loop (bn*beatDuration) instead
of accumulating t += beatDuration — no floating point drift
- Add selectionFollowsTempo toggle button (♪T/⏱T) in transport bar
- ♪T (tempo): selection recalculates with BPM
- ⏱T (time): selection fixed in seconds regardless of BPM
- TimelineRuler draws bar lines at bn * barDuration positions
- Same integer beat loop as TempoTrackLane (bn from firstBarNum)
- Bar number labels at center of ruler
- Time markers still shown below bar markers
- All use same bpm prop → always aligned with tempo track
- Replace t += beatDuration loop (floating accumulation drifts)
- Iterate by integer beat number: t = bn * beatDuration
- Each bar position computed independently, no cumulative error
- Same fix for snapInterval loop
- Fixes unequal bar widths for BPM like 77, 81
- DOM traversal for scrollLeft stops at sticky wrapper (scrollLeft=0)
- Use scrollLeft prop directly instead of traversing parent DOM
- Affects both TimelineRuler and TempoTrackLane canvas effects
- Bars now correctly space when BPM changes
- Items without length_bars: compute bars from duration/secondsPerBar
- Round to nearest quarter bar for musical accuracy
- Recalculate duration = bars * new secondsPerBar for all items
- Maintains correct bar count for both legacy and new items
- Add length_bars field to midiItems and sections at creation
- useEffect on bpm recalculates duration = length_bars * secondsPerBar
- Fix section creation: use secondsPerBar instead of hardcoded 4s
- Handle existing items without length_bars (no-op)
- If click.y + 260 > window.innerHeight: position bottom instead of top
- Also clamp left to prevent right-edge overflow
- Menu now appears above the click point when there's no room below
- Revert AI item startTime to currentTime (playhead position)
- Context menu: maxHeight 60vh + overflow-y-auto, top clamped to
window.innerHeight - 200 to prevent bottom clipping
- Same fix for both main session and sub-tab context menus
- Replace currentTime with auto-calculated maxEnd from existing items
- Each AI generation starts right after the previous one
- Ensures tracks from different generations align in bar columns
- Build synth_engine object with type, plugin_id, soundfont_bank,
soundfont_program, soundfont_id
- Save to targetTrack.synth_engine so schedulePianoRollMidi reads it
- Pass synthEngine as 3rd arg to applyAITrackInstrument (was missing)
- Remove redundant separate loadSoundFont call (applyAITrackInstrument
chains to selectInstrument which already calls loadSoundFont)
- Wrap TimelineRuler + TempoTrackLane in sticky-top div
- Same sticky pattern for both main session and sub-tab views
- TCP column already has sticky header (top-0) and tempo row (top-10)
- Background color hides tracks scrolling behind ruler
- Transport Loop button now syncs isLooping with active sub-tab
- Auto-computes loopEnd from midi notes, section clips, or audio duration
- Sub-tab selectionStart=0, selectionEnd=computed boundary on loop enable
- Main timeline also auto-derives loop end from track items/clips
- All three tab types: MAIN SESSION, SECTION-TAB, PIANO ROLL
- Add _currentSfId tracking
- loadSoundFont calls deleteSoundBank(oldId) before addSoundBank(newId)
- Skip reload if same sfId requested
- Prevents bank accumulation in SpessaSynth
Root cause: timeline play passes exactAudioTime as 4th param which
SpessaSynth interprets as enableReverh (boolean). All notes at T=0.
Fix: compute delay = startTime - ctx.currentTime, use setTimeout
to call noteOn(channel, pitch, vel) at correct future time.
Never pass startTime to noteOn() — SpessaSynth doesn't support it.
Per md/38_FLOWCLIENT.md analysis:
- Add _initPromise to serialize concurrent init calls (no duplicate worklet)
- audioContext.resume() before worklet.loadModule
- selectInstrument creates AudioContext + awaits init if not ready
- playNote tries SpessaSynth first, falls back to oscillator on error
- All MIDI commands wrapped in try/catch with oscillator fallback
- Add missing if (_initialized && _synthInstance) return to init()
- soundBank is main-thread proxy, worklet has actual presets
- Check selectablePresetList.length from soundBankManager (worklet state)
- Log when presets are empty (SpessaSynth parser issue)
Root cause: selectInstrument called before getAudioContext triggers init.
_initialized=false → selectInstrument returns immediately → no sound bank.
Fix: selectInstrument creates AudioContext + calls init() if not ready,
waits for completion before proceeding with bank/program routing.
Per md/38_FLOWCLIENT.md Phase 1: SpessaSynth output was not
connected to speakers. Add synth.connect(audioContext.destination)
after construction to route synthesized audio to user speakers.
Per md/38_FLOWCLIENT.md flow:
- _addBankWithTimeout: wraps SpessaSynth addSoundBank with Promise.race
- 15s timeout breaks deadlock when AudioWorklet parser fails silently
- Phase 3 (channel setup) only runs after Phase 2 (load) confirms success
- Falls back to oscillator when bank can't be loaded
- SpessaSynth bank loading fails in AudioWorklet for unknown reason
- Set _initialized=false after init so playNote uses oscillator path
- Server-side FluidSynth render produces authentic SoundFont audio on Export
- playNote logs warning when _currentSfId is null (no bank)
- _playNoteSpessa catches noteOn errors, falls back to _playNoteOsc
- Prevents 'No preset found' from breaking playback