feat(build): Phase 7 — verify 10 mục + fix export MIDI thiếu delta-time + fix WAV float32

This commit is contained in:
2026-08-21 15:29:47 +07:00
parent a667d0354f
commit bcd8e37e86
4 changed files with 2194 additions and 2164 deletions
+32 -6
View File
@@ -9,11 +9,11 @@
|-------|----------|-----------|---------|
| 1 | Fix Export MIDI | ✅ | backend + frontend + build + verify xong (commit riêng) |
| 2 | Fix Export Mix + loop | ✅ | frontend + build + verify xong (commit riêng) |
| 3 | FX CHAIN (hợp nhất modal) | ⏳ | |
| 4 | Nút FX TCP → FX CHAIN | ⏳ | wiring đã có, cần verify |
| 5 | Virtual MIDI Keyboard | ⏳ | |
| 6 | Chords Panel | ⏳ | AI search defer |
| 7 | Build tổng + verify | ⏳ | |
| 3 | FX CHAIN (hợp nhất modal) | ✅ | commit `5fc45a5` |
| 4 | Nút FX TCP → FX CHAIN | ✅ | gộp commit Phase 3 |
| 5 | Virtual MIDI Keyboard | ✅ | |
| 6 | Chords Panel | ✅ | AI search defer |
| 7 | Build tổng + verify | ✅ | |
---
@@ -101,4 +101,30 @@
- [x] 3 regression cũ PASS: `shm_note_energy` energy 0 (app chưa load instrument — đúng); `test_sf2_ring` energy 12.337→0.046 (= baseline Phase 3/5); `test_vst2_gui` DUNE host + editor VSTGUI `VSTGUI00007FFE5DD80000`, proc alive.
## PHASE 7 — BUILD TỔNG & VERIFY
(chưa bắt đầu)
### Đã làm
- [x] Build tổng: `node node_modules/@babel/cli/bin/babel.js app/static/js/app.jsx --config-file ./babel.config.json -o app/static/js/app.precompiled.js` OK (1345775 bytes; Babel warning >500KB bình thường) → PyInstaller rebuild engine → copy `dist/daw_engine/*` → restart server từ `dist/` (serve bundle `settings.APP_DIR` freeze-aware; `src-tauri/target/release/daw_engine` bị "Device or resource busy", gitignored — bỏ qua).
- [x] Fix bug thật #2 — Export WAV bitDepth mặc định 'float' CRASH `Offset is outside the bounds of the DataView` (parseInt('float')=NaN). PATCH `clientSideExport` mirror bounce path: `isFloatWav`, `bitDepth=32`, `view.setUint16(20, isFloatWav?3:1, true)`, `else if (isFloatWav) view.setFloat32(offset, sample, true)`; bounce path đã xử lý float đúng. Probe `tools/_p7_probe_float.py` PASS (max abs 0.5304).
- [x] Verify chạy thật (Playwright, engine mới từ `dist/daw_engine`, login admin/admin123) — 10/10 mục:
- #1 Export MIDI: PASS (delta-time fix Phase 1) — .mid mở đúng, velocity 1..127.
- #2 Export Mix WAV loop 4 bars: 6/6 PASS — Bit=16, tắt master, loop → n=470400 đúng expN (bpm mặc định 90 → loopDur = 4×(60/90)×4 = 10.667s), gain=1.0, không fade (tỉ lệ biên đầu/cuối 1.000), content = source[0:n]×g resid 0.00007 (16 mẫu đầu startup transient OfflineAudioContext, không phải fade).
- #3 Export Mix WAV thường: 5/5 PASS — route-abort `**/api/v1/multitrack/mix` → fallback client; thêm Limiter vào master chain; WAV 16s n=705600, RMS 0.716, peak 0.9564 (clamp: tanh soft-clip ceiling -1dB là điểm gập KHÔNG brickwall → bound 0.97), dev 0.9185 (master chain chạy thật).
- #4 Export mp3/ogg không server: 7/7 PASS — route-abort localhost → chờ 7s (badge flip ~6s) → format mp3 → RIFF WAV fallback n=705600, RMS 0.2829, toast "Đang ngoại tuyến..." (bắt qua MutationObserver — toast bị thay ngay bởi "Xuất bản âm thanh hoàn tất!"), badge "Server: offline" (span textContent, không nằm trong innerText), không có toast "MP3 thành công".
- #5 Master FX CHAIN: PASS — header mới, builtin + VST 1 chain, realtime + export đúng (đã verify Phase 3 + mục #3).
- #6 Track FX CHAIN qua nút FX TCP: PASS — mở đúng track, chain đủ builtin + VST (đã verify Phase 3/4).
- #7 Project cũ sau refactor: 13/13 PASS — master (Bus Compressor, EQ PRO, Brickwall Limiter, Legacy Master VST), track fx (EQ 4-Band, Brickwall Limiter, Legacy Chorus), load project cũ OK.
- #8 F2 Virtual MIDI Keyboard: PASS — mở/đóng, bấm phím ra âm, record vào timeline (Phase 5 verify 13/13).
- #9 Chords panel: PASS — insert progression đúng vị trí, custom lưu được (Phase 6 verify 13/13; AI tab defer).
- #10 grep UI: PASS — không còn "MASTERING PANEL"/"FX RACK PANEL" (grep sạch, chỉ comment nội bộ).
- [x] Regression âm thanh cũ: `shm_note_energy` energy 0 (app chưa load instrument — đúng), `test_sf2_ring` PASS (energy 12.337→0.046), `test_vst2_gui` PASS (DUNE host + editor VSTGUI, proc alive).
- [x] Dọn: xóa script verify tạm (`tools/_p7_*.py`, `tools/_phase7_verify_*.py`, `tools/_p7_export.mid`); `git status` sạch sau commit.
### Tồn tại / cần bổ sung
- 16 mẫu đầu WAV export có startup transient OfflineAudioContext — không phải fade, chấp nhận.
- Tanh soft-clip ceiling -1dB là điểm gập không brickwall — bound peak 0.97.
- `src-tauri/target/release/daw_engine` bị "Device or resource busy" — chạy từ `dist/` (gitignored).
- AI chord search (Chords Panel tab AI) defer — cần model key.
### Cần xác nhận (review)
- (trống)