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.
This commit is contained in:
2026-07-26 20:16:52 +07:00
parent 400856c0a3
commit de70d4a837
2 changed files with 38 additions and 234 deletions
-7
View File
@@ -127,23 +127,16 @@ async def delete_soundfont(sf_id: str, current_user: dict = Depends(get_current_
@router.get("/soundfonts/download/{sf_id}")
async def download_soundfont_asset(sf_id: str):
import logging as _lg
_log = _lg.getLogger("uvicorn.access")
clean_id = sf_id.replace("sf_", "") if sf_id.startswith("sf_") else sf_id
_log.info(f"[DOWNLOAD_DEBUG] sf_id={sf_id} clean_id={clean_id}")
for base_dir in [UPLOAD_SF_DIR, SYSTEM_SF_DIR]:
if not os.path.isdir(base_dir):
_log.info(f"[DOWNLOAD_DEBUG] dir NOT_FOUND: {base_dir}")
continue
for ext in [".sf2", ".sf3"]:
for fname in os.listdir(base_dir):
fbase, fext = os.path.splitext(fname)
if fext.lower() == ext and fbase.lower() == clean_id.lower():
full = os.path.join(base_dir, fname)
sz = os.path.getsize(full)
_log.info(f"[DOWNLOAD_DEBUG] SERVING: {full} ext={ext} size={sz}")
return FileResponse(full, media_type="application/octet-stream", filename=f"soundfont{ext}")
_log.warning(f"[DOWNLOAD_DEBUG] NOT_FOUND for {sf_id}")
raise HTTPException(status_code=404, detail="SoundFont asset not found")