Files
SonicForgeStudio/TASKS_WINDOWS_AUDIO_NORMALIZE.md
T
3dtours a2f93138be Normalize Linux audio pipeline to lossless Float32 (skill: lossless-audio-compliance)
- native bridge WAV writers: 16-bit PCM truncation -> IEEE Float32 (fmt 3, bit-exact)
- vendor sheredom_json.h (vst3sdk 3.8.1 lacks moduleinfo/json.h)
- Dockerfile: drop nonexistent sfizz tag v1.2.3
- Python sf.write -> subtype=FLOAT everywhere
- resample_poly -> kaiser(16) window (>=130dB stopband)
- audio_editor._write_wav_lossless(): FLOAT passthrough, TPDF dither only for
  8/16/24-bit final exports
- app.jsx WAV encoders: Float32 default, TPDF dither for integer depths, fix 24-bit
- tests: lossless compliance gate (null test < -140dBFS, float32 format) 9/9 pass
- TASKS_WINDOWS_AUDIO_NORMALIZE.md: Windows-side remaining tasks
2026-08-18 11:50:26 +07:00

85 lines
4.0 KiB
Markdown

# TASKS WINDOWS — Chuẩn hóa luồng audio lossless (SonicForgeStudio)
Branch: `standalone-shm-bridge` — Pull code mới nhất trước khi làm.
## Bối cảnh
Linux đã hoàn tất chuẩn hóa luồng audio theo skill `lossless-audio-compliance`
(Float32 nội bộ, WAV IEEE Float32 khi render/export, TPDF dither chỉ ở bước
lượng tử cuối, resample Kaiser ≥130dB, null-test gate). Code C++/Python/JS đã
sửa trên Linux và **commit sẵn** — phần còn lại trên Windows chỉ là BUILD lại
binary, COPY vào `install/`, VERIFY, COMMIT.
## Đã sửa (kèm theo branch này)
| File | Thay đổi |
|---|---|
| `native_bridge/src/RenderJob.cpp`, `RenderFxJob.cpp` | WAV writer: 16-bit PCM (truncate, không dither) → **IEEE Float32** (format 3, 32-bit) |
| `app/core/render_engine.py`, `app/api/v1/audio.py`, `app/api/v1/plugins.py` | `sf.write(...)` → `subtype="FLOAT"` (4 chỗ) |
| `app/core/audio_features.py`, `app/core/render_engine.py` | `resample_poly` → `window=("kaiser", 16)` (stopband ≥130dB) |
| `app/static/js/app.jsx` + `app.precompiled.js` (đã build trên Linux) | Encoder client → Float32 mặc định; TPDF dither cho 16/24/8-bit; sửa bug 24-bit ghi nhầm 8-bit; UI thêm "32 float" |
| `app/templates/index.html` | bump cache `?v=20260818` |
| `tests/test_lossless_compliance.py` (mới) | Null-test gate (Rule 6) + assert float32 WAV (Rule 7) + bridge render deterministic |
| `native_bridge/tests/test_offline_render.py` | `read_wav` hiểu cả IEEE float32 lẫn PCM 16-bit |
| `Dockerfile` | fix `git clone --branch v1.2.3` (tag không tồn tại) → clone default |
## Tasks trên Windows (theo thứ tự)
### 1. Pull code mới nhất
```powershell
cd C:\Users\locpham\SonicForgeStudio
git checkout standalone-shm-bridge
git pull origin standalone-shm-bridge
```
### 2. Build lại `daw_vst_bridge.exe` (WAV writer float32)
Bridge build bằng CMake + vcpkg (fluidsynth) + sfizz-src (xem
`native_bridge/CMakeLists.txt`, `build/_sfizz.bat`):
```powershell
# sfizz từ source nếu chưa có (native_bridge/sfizz-src)
# vcpkg install fluidsynth
cmake -S native_bridge -B build/bridge-win -DCMAKE_BUILD_TYPE=Release `
-DCMAKE_TOOLCHAIN_FILE=<vcpkg-root>\scripts\buildsystems\vcpkg.cmake
cmake --build build/bridge-win --target daw_vst_bridge --config Release
Copy-Item build/bridge-win/Release/daw_vst_bridge.exe install/daw_vst_bridge.exe -Force
```
Nếu có script build sẵn dùng script đó; **bắt buộc copy đè** `install/daw_vst_bridge.exe`.
### 3. Build lại engine + app (`build_windows.ps1`)
```powershell
powershell -ExecutionPolicy Bypass -File build_windows.ps1
```
(Lưu ý: `app.precompiled.js` đã build sẵn trên Linux — bước [2/6] chỉ cần chạy
lại nếu bạn sửa `app.jsx`.)
### 4. Copy binary mới vào `install/`
```powershell
Copy-Item src-tauri\target\release\sonicforge-daw.exe install\sonicforge-daw.exe -Force
# hoặc từ NSIS/MSI output tùy quy trình hiện tại
```
### 5. Verify (null-test gate + định dạng float32)
```powershell
python tests\test_lossless_compliance.py
python native_bridge\tests\test_offline_render.py
```
Kỳ vọng:
- `bridge output IEEE float32 (tag 3)` PASS — WAV render ra format 3, 32-bit
- `bridge render deterministic (byte-identical)` PASS
- `null test ... bit-exact` PASS
- `test_offline_render.py` 3 test đầu PASS với `read_wav` mới
### 6. Commit + push
```powershell
git add install/daw_vst_bridge.exe install/sonicforge-daw.exe
git commit -m "feat(audio): lossless float32 WAV render/export (bridge + engine) — chuẩn hóa luồng audio"
git push origin standalone-shm-bridge
```
## Lưu ý
- Không đổi lại WAV writer sang 16-bit: render nội bộ phải là IEEE Float32
(skill Rule 4/7); dither TPDF chỉ áp dụng ở bước export cuối (client 16/24-bit).
- `install/daw_vst_bridge` (ELF Linux) không commit — chỉ commit `.exe`.
- Nếu `sonicforge-daw.exe` bundle cũ vẫn dùng `app.precompiled.js` cũ: xóa cache
trình duyệt / dùng `?v=` mới đã bump.