2025-08-21 00:47:47 +09:00
|
|
|
# uj-mastering-master
|
|
|
|
|
|
|
|
|
|
A custom mastering toolkit that provides metrics to evaluate audio masterings through visual analysis.
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
## Current implementation
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Core features
|
2025-08-22 00:26:27 +09:00
|
|
|
- **Audio Analysis**: Uses librosa to analyze audio files (MP3/WAV/FLAC support)
|
2026-05-30 00:42:45 +09:00
|
|
|
- **Pluggable Metrics**: Switchable visualizations (RMS Power, Waveform, LUFS; DR next) via a `Metric` ABC
|
2025-08-21 00:47:47 +09:00
|
|
|
- **Metadata Extraction**: Reads ID3 tags from MP3 files for better file identification
|
2025-08-22 00:26:27 +09:00
|
|
|
- **Modular GUI Architecture**: Complete PyQt5 interface with drag-and-drop and file dialog support
|
|
|
|
|
- **Font Management**: Comprehensive CJK-compatible font system with user-provided font support
|
|
|
|
|
- **Threading & Logging**: Robust background processing with detailed logging system
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Technical stack
|
2025-08-21 00:47:47 +09:00
|
|
|
- **Audio Processing**: librosa, numpy
|
2025-08-22 00:26:27 +09:00
|
|
|
- **Visualization**: matplotlib with custom colormaps and embedded Qt widgets
|
|
|
|
|
- **GUI Framework**: PyQt5 with modular widget architecture
|
|
|
|
|
- **Metadata**: mutagen for audio tag reading
|
|
|
|
|
- **Font Support**: Custom font loading system with CJK fallback
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Key components
|
2025-08-21 00:47:47 +09:00
|
|
|
|
|
|
|
|
#### `main.py`
|
2025-08-22 00:26:27 +09:00
|
|
|
- Complete GUI application with modular architecture
|
|
|
|
|
- Drag-and-drop and file dialog support for audio files
|
|
|
|
|
- Integrated font control system
|
|
|
|
|
- Real-time analysis display and file management
|
|
|
|
|
|
|
|
|
|
#### `analysis_results_manager.py`
|
|
|
|
|
- Background threading for audio analysis
|
2026-05-30 00:42:45 +09:00
|
|
|
- Caches both the loaded `AudioFile` and per-metric `compute()` output, so
|
|
|
|
|
metric/font switches re-render from cache without reloading librosa
|
2025-08-22 00:26:27 +09:00
|
|
|
- Progress tracking and error handling
|
|
|
|
|
|
|
|
|
|
#### `audio_visualization_widget.py`
|
|
|
|
|
- Embedded matplotlib visualization with Qt integration
|
|
|
|
|
- Real-time plot updates and status display
|
|
|
|
|
|
|
|
|
|
#### `font_control_widget.py` & `font_manager.py`
|
|
|
|
|
- Unified font control system with clustered interface
|
|
|
|
|
- Auto-detection of custom fonts from `fonts/` directory
|
|
|
|
|
- System font discovery and CJK compatibility
|
2026-05-30 00:42:45 +09:00
|
|
|
- Font changes trigger a cheap re-render of the cached metric data
|
|
|
|
|
|
|
|
|
|
#### `plot_control_widget.py`
|
|
|
|
|
- Metric selector dropdown driven by the `metrics.METRICS` registry
|
|
|
|
|
- Houses the `Refresh Plot` button (foundation for upcoming style controls)
|
|
|
|
|
|
|
|
|
|
#### `metrics.py`
|
|
|
|
|
- Pluggable `Metric` ABC: `compute(audio_file) -> data` (heavy, worker thread)
|
|
|
|
|
and `render(data, file_path) -> Figure` (cheap, GUI thread)
|
|
|
|
|
- Current registry: `RMSPowerMetric`, `WaveformMetric`, `LUFSMetric`
|
|
|
|
|
(BS.1770 short-term + integrated, via pyloudnorm) — drop in new ones (DR,
|
|
|
|
|
spectrum) by appending an instance to `METRICS`
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:26:27 +09:00
|
|
|
#### `master_core.py`
|
2026-05-28 14:05:34 +09:00
|
|
|
- Defines the `AudioFile` class: librosa loading, rolling RMS power, BPM detection
|
|
|
|
|
- No batch / CLI mode — all analysis is driven from `main.py` via `AnalysisResultsManager`
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Current analysis features
|
|
|
|
|
- **RMS power analysis**: 10-second rolling window with 2-second hops
|
|
|
|
|
- **Adaptive colour mapping**: Automatically adjusts scale based on detected headroom
|
2025-08-22 00:26:27 +09:00
|
|
|
- High dynamic range: 0-0.6 scale for loud masters
|
2025-08-21 00:47:47 +09:00
|
|
|
- Conservative mastering: 0-0.3 scale for quiet masters
|
2025-08-22 00:36:33 +09:00
|
|
|
- **BPM detection**: Automatic tempo analysis
|
|
|
|
|
- **Metadata display**: Artist and title from audio tags
|
|
|
|
|
- **Real-time visualization**: Embedded matplotlib plots with font-aware rendering
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### GUI features
|
|
|
|
|
- **File management**: Drag-and-drop and file dialog for audio selection
|
2026-05-30 00:42:45 +09:00
|
|
|
- **Font control**: Unified font selector with size control
|
|
|
|
|
- **Plot control**: Metric selector + refresh-plot button
|
2025-08-22 00:36:33 +09:00
|
|
|
- **Analysis display**: Real-time visualization with metadata panels
|
|
|
|
|
- **Modular architecture**: Self-contained widgets for easy layout management
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
## Future development plans
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Short-term (urgent)
|
2026-05-30 00:42:45 +09:00
|
|
|
1. **Plot control widget cluster** *(metric selector + Refresh Plot done; still TODO)*
|
|
|
|
|
- Plot style controller (colormap, line vs bar, etc.)
|
|
|
|
|
- Foundation for mastering comparison features
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Short-term (not urgent)
|
2026-05-30 00:42:45 +09:00
|
|
|
1. **Enhanced metrics** *(plug new ones into `metrics.METRICS`)*
|
2025-08-21 00:47:47 +09:00
|
|
|
- Dynamic range measurement (DR meter)
|
|
|
|
|
- Peak-to-average ratio analysis
|
|
|
|
|
- Frequency spectrum analysis
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
2. **Interactive plot features**
|
2025-08-22 00:26:27 +09:00
|
|
|
- GUI-controllable plotting styles (colormap, visualization type)
|
|
|
|
|
- Select axis ranges on the fly with automatic graph updates
|
|
|
|
|
- Zoom/pan controls for detailed analysis
|
2025-08-21 00:47:47 +09:00
|
|
|
- Export analysis results to CSV/JSON
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
3. **Advanced GUI controls**
|
2025-08-22 00:26:27 +09:00
|
|
|
- Plot style customization interface
|
2025-08-22 00:36:33 +09:00
|
|
|
- Real-time axis range selection (zooming in/out)
|
2025-08-22 00:26:27 +09:00
|
|
|
- Interactive plot manipulation tools
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
4. **Better looking UI**
|
|
|
|
|
- Graphical loading bar
|
|
|
|
|
- Graphical logging text box
|
|
|
|
|
|
|
|
|
|
### Mid-to-long-term (very not urgent)
|
|
|
|
|
1. **Audio comparison system**
|
2025-08-22 00:26:27 +09:00
|
|
|
- Reference vs. comparee audio file analysis
|
|
|
|
|
- Side-by-side track comparison interface
|
|
|
|
|
- A/B testing for mastering versions
|
|
|
|
|
- Overlay visualization for comparative analysis
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
2. **Distribution & deployment**
|
2025-08-22 00:26:27 +09:00
|
|
|
- Self-contained executable releases
|
|
|
|
|
- Cross-platform packaging
|
|
|
|
|
- Installer creation and distribution
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Future vision
|
|
|
|
|
1. **Advanced analysis tools**
|
2025-08-21 00:47:47 +09:00
|
|
|
- Spectral centroid and bandwidth analysis
|
|
|
|
|
- Stereo width measurements
|
|
|
|
|
- Transient detection and analysis
|
|
|
|
|
- Harmonic distortion detection
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
2. **Professional features**
|
2025-08-21 00:47:47 +09:00
|
|
|
- EBU R128 compliance checking
|
|
|
|
|
- Custom target curves
|
|
|
|
|
- Professional reporting formats
|
|
|
|
|
- Multi-format export capabilities
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
3. **VST plugin development**
|
2025-08-22 00:26:27 +09:00
|
|
|
- Real-time analysis during mixing/mastering
|
|
|
|
|
- Integration with DAWs
|
|
|
|
|
- Live feedback during production
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
## Development notes
|
2025-08-21 00:47:47 +09:00
|
|
|
|
|
|
|
|
### Dependencies
|
|
|
|
|
- librosa: Audio analysis and feature extraction
|
|
|
|
|
- numpy: Numerical computations
|
|
|
|
|
- matplotlib: Plotting and visualization
|
|
|
|
|
- mutagen: Audio metadata extraction
|
|
|
|
|
- PyQt5: GUI framework
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Architecture considerations
|
2025-08-21 00:47:47 +09:00
|
|
|
- Current code mixes analysis and visualization - consider separation
|
|
|
|
|
- File path handling needs improvement for cross-platform compatibility
|
|
|
|
|
- Error handling should be enhanced for production use
|
|
|
|
|
- Consider moving from PyQt5 to PyQt6 or PySide for better licensing
|
|
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Testing requirements
|
2025-08-21 00:47:47 +09:00
|
|
|
- Unit tests for audio analysis functions
|
|
|
|
|
- GUI component testing
|
|
|
|
|
- File format compatibility testing
|
|
|
|
|
- Performance testing with large audio files
|
|
|
|
|
|
|
|
|
|
## Usage
|
|
|
|
|
|
2026-05-28 14:05:34 +09:00
|
|
|
### Running the app
|
|
|
|
|
```bash
|
|
|
|
|
uv sync # one-time, after cloning
|
|
|
|
|
uv run ujm # launch the GUI
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Optional flags (handled by `logger_setup.parse_log_args`):
|
|
|
|
|
```bash
|
|
|
|
|
uv run ujm --log-level DEBUG # ERROR | WARN | INFO | DEBUG | TRACE
|
|
|
|
|
uv run ujm --log-file # also write audio_analysis.log
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
The only entry point is `ujm` (defined in `pyproject.toml` as
|
|
|
|
|
`ujm = "main:main"`). The previous `files.txt` batch mode and the
|
|
|
|
|
`python master_core.py` workflow have been removed.
|
2025-08-21 00:47:47 +09:00
|
|
|
|
2025-08-22 00:36:33 +09:00
|
|
|
### Planned usage enhancements
|
2025-08-22 00:26:27 +09:00
|
|
|
1. Interactive plot manipulation and style customization
|
|
|
|
|
2. LUFS and advanced metric analysis
|
|
|
|
|
3. Audio file comparison features
|
|
|
|
|
4. Self-contained executable releases
|