Files
uj-mastering-master/pyproject.toml
mikkeli e8da88b6c1 Run the web UI entirely in the browser
The FastAPI backend kept one analysis session shared by every visitor and
spooled each upload to the server's /tmp, and the browser copied audio into
persistent OPFS storage. None of that fits a tool for unreleased masters, so
the web UI is now a static site that decodes and analyses in the tab:

- web/decode.js: WAV/AIFF PCM and float read directly with libsndfile's
  scaling (bit-identical to librosa.load; Chromium's WAV decoder scales
  positive int16 by 1/32767), other formats via decodeAudioData on an
  OfflineAudioContext at the header-sniffed native rate. ID3 song names.
- web/dsp.js: ports of every Metric.compute with the same numerics
  (pyloudnorm K-weighting via lfilter's DF2T recurrence, BS.1770 gating,
  EBU LRA, resample_poly's Kaiser filter for true peak, librosa.stft and
  amplitude_to_db), streaming passes with no signal-length intermediates.
- web/metrics.js: build_spec ports producing the existing plot payload.
- web/analysis-worker.js + app.js: per-tab track list and result cache, a
  worker job queue where the visible metric jumps background prefetch, and
  the renderer, which now also draws the metrics' own reference lines.

Deployment is nginx-unprivileged serving web/ read-only with
Content-Security-Policy connect-src 'none', so the page cannot make network
requests at all, and no access log. No secure context is needed, so plain
http on a LAN works. The Python web backend, its smoke test, the web extra
and the OPFS store are removed; the desktop app is unchanged.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015UXA39Sh9coAx4FhRkd8R2
2026-09-14 10:16:52 +09:00

60 lines
1.6 KiB
TOML

[build-system]
requires = ["setuptools>=68"]
build-backend = "setuptools.build_meta"
[project]
name = "uj-mastering-master"
version = "0.1.0"
requires-python = ">=3.10"
# What the *analysis* needs. The GUI stack lives in the `desktop` extra below.
# The web UI (web/) is a static site that analyses audio in the browser and needs
# none of these; `tests/parity` uses them to check the browser port against
# `metrics.py`.
dependencies = [
"librosa",
"numpy",
"matplotlib", # librosa dependency, and colormaps for the colormap helper
"mutagen",
"pyloudnorm",
]
license = {text = "Apache-2.0"}
[project.optional-dependencies]
# Desktop GUI. Installed with:
# uv sync --extra desktop (or `uv sync --all-extras`)
desktop = [
"PyQt5>=5.15.10",
# 5.15.2 is the only pyqt5-qt5 release with a Windows wheel; later
# versions are Linux/macOS only.
"PyQt5-Qt5==5.15.2 ; sys_platform == 'win32'",
"pyqtgraph>=0.14.0",
]
[tool.uv]
# Note: `default-groups` cannot name an entry from `[project.optional-dependencies]`
# — it only accepts `[dependency-groups]` names, and errors with "Default group
# `desktop` ... is not defined in the project's `dependency-groups` table".
# Extras must be requested explicitly:
# uv sync # analysis only
# uv sync --extra desktop # + Qt/pyqtgraph (the GUI; `uv run ujm`)
[project.scripts]
ujm = "main:main"
[tool.setuptools]
py-modules = [
"main",
"analysis_results_manager",
"audio_visualization_widget",
"master_core",
"metrics",
"plotspec",
"font_manager",
"plot_control_widget",
"ref_line_widget",
"logger_setup",
"setup_fonts",
]