- 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
- Add importmap in index.html to map spessasynth_core to CDN URL
- Load spessasynth_lib from CDN directly (with importmap resolving deps)
- WorkerSynthesizer fallback also uses CDN import
- Ensures library and processor use same spessasynth_core version
- Download spessasynth_processor.min.js from CDN, serve as static file
- Change __SpessaSynthCDN to /static/js/services/
- Fix version mismatch between esm.sh library and CDN processor
- Clone ArrayBuffer before sendToWorklet (transfer neuters original)
- Re-await synthInstance.isReady after addSoundBank
- Force controllerChange(0,0,0) + programChange(0,0) after load
- Add _initInProgress flag to prevent concurrent init calls
- Remove auto-loadSoundFont from init (confuses user when loading DSK)
- SF3 loading happens only when user selects an instrument
- _find_chunk starts at offset 12 (after RIFF header)
- Add _find_list_of_type to locate sdta LIST
- Update sdta LIST size after smpl data replacement
- Fix 'Invalid chunk header' error in SpessaSynth
- SGM_v2.01 too large (529MB WAV) falls back to SF2
- Frontend serialize: use undefined instead of null for synth_engine
- Backend validate: strip None synth_engine from tracks before schema validation
- Prevents 'None is not of type object' schema error
- jdelivr raw index.js has bare import 'spessasynth_core' which browser can't resolve
- esm.sh automatically rewrites bare imports to full URLs
- Keep jdelivr for worklet processor (self-contained, no imports)
- WorkerSynthesizer fallback also uses esm.sh