Commit Graph

59 Commits

Author SHA1 Message Date
3dtours 5a49d2012b feat: sustain (CC64), modulation (CC1), pitch bend for MIDI keyboard
- 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)
2026-07-27 11:02:45 +07:00
3dtours 5c47b68a9d fix: single Synth button opens instrument modal, fix init race condition
- 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
2026-07-27 10:54:58 +07:00
3dtours 45a86f09bd fix: keep all banks loaded, don't delete on switch
- Remove deleteSoundBank — SpessaSynth merges presets from all banks
- Check soundBankList for existing bank before re-downloading
- Handle 404 gracefully — warn but don't break subsequent loads
- Failed load doesn't delete previously loaded banks
2026-07-26 22:03:49 +07:00
3dtours cdd5f8c96b fix: stopAll cancels scheduled notes, loop works on all tabs
- Add _scheduledNotes array tracking
- stopAll clears all pending setTimeout notes + allNotesOff()
- Loop enabled on MAIN SESSION, SECTION-TAB, PIANO_ROLL via
  isLoopingSelection + selLeft/selRight auto-derivation
2026-07-26 21:16:49 +07:00
3dtours f96064cbab fix: unload old SoundFont before loading new one
- Add _currentSfId tracking
- loadSoundFont calls deleteSoundBank(oldId) before addSoundBank(newId)
- Skip reload if same sfId requested
- Prevents bank accumulation in SpessaSynth
2026-07-26 20:52:48 +07:00
3dtours 28be934a19 fix: schedule SpessaSynth noteOn by startTime via setTimeout
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.
2026-07-26 20:47:15 +07:00
3dtours 2f2cb3a066 fix: implement proper init chain + AudioContext.resume + _initPromise
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
2026-07-26 20:23:22 +07:00
3dtours de70d4a837 clean: stable oscillator-only client preview, remove debug logs
SpessaSynth's SoundBankLoader.fromArrayBuffer extracts 0 presets
from SF2 files (parser limitation). Client preview always uses
oscillator (reliable, approximate GM ADSR per program).
Server-side FluidSynth render provides authentic SoundFont audio.
2026-07-26 20:16:52 +07:00
3dtours 400856c0a3 fix: add init guard, log selectablePresetList count
- 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)
2026-07-26 20:15:24 +07:00
3dtours d117a363da debug: log soundBank keys, instruments, samples, _presetList to find why presets empty 2026-07-26 20:11:36 +07:00
3dtours cca970c348 fix: selectInstrument auto-inits SpessaSynth if not ready
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.
2026-07-26 20:09:22 +07:00
3dtours 5eb0c26ce4 debug: add detailed tracing logs for entire SF download→SpessaSynth flow 2026-07-26 20:05:34 +07:00
3dtours 6242eba3c8 debug: add bank count log in noteOn, SpessaSynth play tries then falls back 2026-07-26 20:00:17 +07:00
3dtours 3c7a002b2c fix: connect SpessaSynth output to audioCtx.destination
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.
2026-07-26 19:56:28 +07:00
3dtours 8f4a4cd0eb fix: add 15s timeout for addSoundBank (hangs on parse error)
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
2026-07-26 19:53:20 +07:00
3dtours f41422da03 fix: disable SpessaSynth playback, use oscillator for client preview
- 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
2026-07-26 19:49:08 +07:00
3dtours 9cad9f6c95 fix: SpessaSynth noteOn catches 'No preset found' error, falls back to oscillator
- playNote logs warning when _currentSfId is null (no bank)
- _playNoteSpessa catches noteOn errors, falls back to _playNoteOsc
- Prevents 'No preset found' from breaking playback
2026-07-26 19:46:50 +07:00
3dtours 09231d9b21 fix: explicit selectInstrument for SpessaSynth bank+program routing
Per md/37_FIXVST3_SUGGEST.md:
- Add SonicSF.selectInstrument(channel, bank, program, sfId) method
- Always sends controllerChange(CC0, bank) + programChange(prog) to SpessaSynth
- _playNoteSpessa also sends CC32 (bank LSB) before programChange
- Remove default bank auto-load from init (cleaner startup)
- Fix syntax error (double }} from previous edit)
- playNote Spessa: use program arg + synthEngine bank/program properly
2026-07-26 19:37:29 +07:00
3dtours 6d9060a52b fix: gracefully fallback to oscillator when SpessaSynth bank load fails
- SpessaSynth init tries to load default bank, gracefully handles failure
- When bank load fails, _currentSfId stays null → _playNoteOsc fallback
- Client preview: oscillator emulation (approximate GM sound)
- Server-side render via FluidSynth: authentic SoundFont audio
2026-07-26 19:32:32 +07:00
3dtours 263c4be409 fix: use importmap to resolve spessasynth_core bare import
- 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
2026-07-26 18:55:08 +07:00
3dtours 50847fc440 fix: WorkerSynthesizer fallback, remove non-existent BasicSynthesizer 2026-07-26 18:53:12 +07:00
3dtours 4d42b8407c fix: serve SpessaSynth processor locally to avoid CDN version mismatch
- 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
2026-07-26 18:47:32 +07:00
3dtours c884f3c533 fix: clone buffer before addSoundBank, re-await isReady, force program 0
- Clone ArrayBuffer before sendToWorklet (transfer neuters original)
- Re-await synthInstance.isReady after addSoundBank
- Force controllerChange(0,0,0) + programChange(0,0) after load
2026-07-26 18:44:43 +07:00
3dtours 5096c618b4 fix: SF3 download prefers SF2, cache invalidation on parse error
- Download endpoint reverses extension priority: .sf2 > .sf3
- loadSoundFont adds ?t= cache-buster, invalidates IndexedDB on error
- Retry logic: delete corrupted cache entry, allow re-download
2026-07-26 18:37:46 +07:00
3dtours e7a0a85eca fix: SpessaSynth init race condition, remove auto-load of sgm_v2.01
- 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
2026-07-26 18:33:04 +07:00
3dtours 09def59cac fix: use esm.sh CDN to resolve spessasynth_core bare import
- 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
2026-07-26 18:09:12 +07:00
3dtours 0271be4484 fix: SpessaSynth CDN URL + AudioWorklet init flow
- Fix CDN URL: spessasynth_lib@4.3.1/dist/index.js (was @latest with wrong path)
- Use WorkletSynthesizer instead of Synthesizer (correct class name)
- Add audioWorklet.addModule() for processor CDN URL
- Await synth.isReady before use
- Use soundBankManager.addSoundBank() (correct API)
- Fallback to WorkerSynthesizer if AudioWorklet fails
2026-07-26 18:05:44 +07:00
3dtours 23601007bf fix: SpessaSynth init retry + default SF3 auto-load
- getAudioContext() calls SonicSF.init on every call (not just first)
- soundfontPlayer.init retries after 1s if SpessaSynth module not loaded yet
- Auto-loads sgm_v2.01 SF3 on successful init
- Fixes race condition: module script loads after regular scripts
2026-07-26 17:59:15 +07:00
3dtours e51b7fd355 feat: SF3 conversion + SpessaSynth client player
Server:
- soundfont_converter.py: Python SF2->SF3 via ffmpeg Ogg compression
- batch_convert_all runs on startup (daemon thread)
- GET /soundfonts/download/{sf_id} serves SF3 with SF2 fallback
- Dockerfile: add fluidsynth, vorbis-tools

Client:
- soundfontStorage.js: IndexedDB cache for SF3 buffers
- soundfontPlayer.js: dual-mode (SpessaSynth + oscillator fallback)
- app.jsx: init SpessaSynth, loadSF on instrument select
- index.html: SpessaSynth CDN import + storage script tag

Compression: DSK 11M->1.1M (90%), SGM 529M->18M (97%)
2026-07-26 17:51:37 +07:00
3dtours d48262d468 feat(engine): fix SF2 path resolution, add synth_engine struct and fallback chain
- Fix SF2 path: search upload dir, system dir, static dir (backward compat)
- Add synth_engine struct parsing with flat field fallback
- Add 3-level fallback: selected SF -> default SF -> oscillator synth
- Write synth_engine in setTrackInstrument UI setters
- Pass synth_engine context to client SoundFontPlayer and AI gateway
2026-07-26 16:49:40 +07:00
3dtours 89c7237379 feat: add SoundFont inspection engine + AI instrument schema
- SoundFontInspector (sf2utils) scans .sf2, generates full/condensed catalog
- GET /api/v1/plugins/soundfonts/catalog with lazy init + cache invalidation
- AI tool generate_multitrack_midi now requires soundfont_id/bank/program
- Condensed catalog auto-injected into AI system prompt with bank rules
- Server render: FluidSynth program_select uses bank/program + channel routing (drums→ch9)
- VST3 pedalboard path inserts CC0 bank select + program change before notes
- DecentSamplerManager loads .dspreset with CWD fix for relative sample paths
- Pianobook render branch in render_engine.py
- Client SonicSF: controllerChange, programChange, applyAITrackInstrument
- Post-AI track creation applies instrument via applyAITrackInstrument
- Background cache rescan on .sf2 upload, frontend re-fetches catalog
- libcurl4 + VST3 dirs in Dockerfile
2026-07-26 12:36:48 +07:00
3dtours b0d7f35a1e fix(piano-roll): loop only on btn + instant stop
- Sub-tab selection loop only active when st.isLooping is true
- End-of-playback loop uses st.isLooping, not global isLoopingSelection
- SonicSF.stopAll() sets gain 0 and stops oscillators immediately
2026-07-26 12:16:01 +07:00
3dtours 4e880850f5 fix(piano-roll): playhead seek + sound cracking
- Piano roll ruler click during playback now seeks and continues playing
- ADSR envelope uses linearRampToValueAtTime for crack-free release
- stopAll ramps gain to 0 in 20ms before stopping oscillators
2026-07-26 12:03:29 +07:00
3dtours 1ffdec68c6 fix: ruler click 200ms timeout + default instrument attackTime 0.03 + safe ramp 2026-07-26 11:51:50 +07:00
3dtours e18b261943 fix: ruler range drag/move, default cursor, SonicSF smooth stopAll 2026-07-26 11:42:06 +07:00
3dtours 6a17e7036c fix: nhãn của soundfont hiển thị sai và không load được instrument 2026-07-23 22:32:19 +07:00
3dtours 1a28ebabee fix: piano roll và main session play 2026-07-23 21:05:26 +07:00
3dtours dac661e6c6 fix: piano roll tab có thể play với soundfont 2026-07-23 20:34:52 +07:00
3dtours a21266736c fix: synth để gắn soundfont cho midi 2026-07-23 19:26:26 +07:00
3dtours 055f351a17 fix: sửa lỗi cho AI thực hiện tạo MIDI 2026-07-23 18:19:12 +07:00
3dtours 225f23516f feat: thêm soundfont và VSTi cho MIDI 2026-07-23 17:47:46 +07:00
3dtours 0e44e44ecb feat: bổ sung MIDI 2026-07-23 08:32:23 +07:00
3dtours 9bf9f38864 feat: thêm tính năng lưu dự án bằng modal, Lưu dưới tên khác (Save As) và quản trị dự án/tệp tin trong Hồ sơ cá nhân 2026-07-22 18:42:14 +07:00
3dtours b9c524230d fix: tự động dịch chuyển thanh cuộn xuống dưới cùng 2026-07-22 17:49:08 +07:00
3dtours 610c384bca fix: copilot Multi-tool Calling) 2026-07-22 17:20:41 +07:00
3dtours d6fe1326c5 fix: sửa copilot không gửi AI provider 2 2026-07-22 17:01:41 +07:00
3dtours 8a85dd2dfc fix: sửa copilot không gửi AI provider 2026-07-22 15:02:43 +07:00
3dtours b78193dfad fix: sửa UI của bars và lưu thông tin vào profile 2026-07-22 10:54:24 +07:00
3dtours 6fd9db54cf fix: sửa các tools của AI 2026-07-22 09:59:43 +07:00
3dtours 108943ae81 fix: thêm và sửa các tools của AI 2026-07-22 09:51:27 +07:00