Mikkeli Matlock 11182472e3 Add Tier-1 mastering metrics: Crest Factor, PSR, True Peak; LRA on LUFS
Three new metrics plug into the existing Metric registry. All inherit
the async compute path, so first-use is non-blocking and subsequent
switches hit the per-(file, metric) cache.

- CrestFactorMetric: 20*log10(peak/RMS) per 1 s window, 0.25 s hop.
  Uses cumsum-of-squares for O(N) RMS. Reference lines at 12 dB
  (roomy) and 6 dB (heavily limited).
- PSRMetric: sample-peak (dBFS) minus short-term LUFS over the same
  3 s window as LUFSMetric, so the two plots line up. Reference lines
  at 10 LU (good punch) and 4 LU (squashed).
- TruePeakMetric: ITU-R BS.1770 oversampled true peak via
  scipy.signal.resample_poly at 4x over 250 ms / 100 ms windows.
  data["integrated_tp_db"] carries the track-wide max.
- LUFSMetric now also computes Meter.loudness_range and surfaces it
  in the plot legend alongside the integrated value.
- Shared _to_dbfs helper floors 20*log10 at _EPS so silent windows
  don't explode.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 21:22:36 +09:00
2026-05-28 14:05:34 +09:00
2026-05-28 14:05:34 +09:00
2026-05-28 14:05:34 +09:00
2024-04-10 20:14:02 +09:00
2026-05-28 14:05:34 +09:00

uj-mastering-master

Custom mastering toolkit providing visual metrics for evaluating audio masterings. Developed with Claude Code assistance.

Features

Current

  • PyQt5 GUI: drag-and-drop or file-dialog ingest of .mp3, .wav, .flac
  • RMS power analysis on a 10 s rolling window with adaptive colour scale
  • BPM detection via librosa
  • CJK-safe font system with custom fonts loaded from fonts/ (gitignored), system fallbacks, and a live font selector
  • Background analysis thread so the UI stays responsive
  • Embedded matplotlib canvas with auto-regenerated plots on font change

Roadmap

See CLAUDE.md for the full development roadmap. Near-term: dynamic range, plot-style controls, interactive axis controls.

Quick start

This project uses uv. With uv installed:

uv sync
uv run ujm

uv run ujm is the only supported entry point — it boots the GUI.

Logging flags

uv run ujm --log-level DEBUG       # ERROR | WARN | INFO | DEBUG | TRACE
uv run ujm --log-file               # also write audio_analysis.log

Fonts

Drop .ttf / .otf / .ttc files into fonts/ to get them in the font selector. The directory is gitignored to avoid bundling licensed font data. See CJK_FONTS.md for details.

Dependencies

librosa, numpy, matplotlib, mutagen, pyloudnorm, PyQt5 — all pinned through uv.lock. Python 3.10+.

Architecture

Module Responsibility
main.py MainWindow + the ujm entry point
analysis_results_manager.py Background QThread worker, result + metric-data cache
master_core.py AudioFile: librosa loading, RMS rolling window, BPM
metrics.py Pluggable Metric ABC + registry (RMS Power, Waveform, …)
audio_visualization_widget.py Embedded FigureCanvasQTAgg host
font_manager.py Custom + system CJK font discovery, matplotlib/Qt config
font_control_widget.py Font picker + size slider
plot_control_widget.py Metric selector + refresh-plot button
logger_setup.py CLI log-level parsing + custom TRACE level
setup_fonts.py Diagnostic utility (run standalone)

Adding a metric

Subclass Metric in metrics.py, implement compute(audio_file) -> data (the heavy part, runs on the worker thread) and render(data, file_path) -> Figure (cheap, runs on the GUI thread). Register the instance in the METRICS dict at the bottom of the file — it shows up in the dropdown automatically.

S
Description
Mastering helper
Readme GPL-3.0 478 KiB
Languages
Python 100%