- Zig 99.4%
- Shell 0.6%
|
|
||
|---|---|---|
| LICENSES | ||
| scripts | ||
| src | ||
| .gitignore | ||
| build.zig | ||
| build.zig.zon | ||
| README.org | ||
| REUSE.toml | ||
sd2 – Album analysis tool
Introduction
This software extracts the following characteristics from audio files:
- maximum True Peak Level
- Integrated Loudness (full scale)
- Loudness Range
- average RMS
- average CREST
- average Peak to Loudness Ratio
It is:
- EBU R 128 compliant
- optimised for bulk folder (album) analysis
- quick
- ergonomic
- portable
- libre
Origin
This project was concieved as I grew tired of using XiVero's MusicScope which was slow, not made for mass analysis, windows-only and proprietary. This is basically a rewrite of it's album analysis functionalities.
The first C prototype was created in 2024 and the Zig rewrite took place in 2025.
Also this project was my engineering thesis.
Installation
Prerequisites
This software is written in Zig. To see the minimal version required to compile this project see the build.zig.zon file.
It also uses the following libraries:
- C sndfile for reading sound files
- C ebur128 for complex audio analysis
- Zig yazap for the CLI
- Zig zig-time for human readable timestamps in reports (optional)
C libraries need to be installed by the system package manager while the Zig ones are fetched automatically and statically linked.
Compilation
To compile this project with optimizing for execution speed run the following command at the root of this repository:
zig build --release=fast
Compile-time options
This project has a couple of compile-time options that can be switched
with -D<option>=<bool>:
with_timeenables human readable timestamps in reportssmall_floatenbles using 16bit float for storing analysis data
Usage
Just give the software a path to some TARGETS (folders and/or files)!
An analysed file's characteristics will be printed to stdout and folder's will be saved to a report in that folder.
Sample folder analysis
$ sd2 /path/to/target/
info: Analyzing 3 files in folder: target
info: Analyzed: intro.flac
info: Analyzed: track.flac
info: Analyzed: outro.flac
info: Report generated!
Sample report.org file
#+TITLE: Audio analysis report
#+SUBTITLE: for folder "Hybrid_Theory"
#+DATE: Tue, 24 Oct 2000 12:34:56 UTC
#+ORIGIN: sd2 1.0.0
| File name | BD | SR [Hz] | mTPL | I-LUFS | LRA | aRMS | aCREST | aPLR |
|------------------------------------|----|---------|------|--------|-------|-------|--------|------|
| 101_Papercut.flac | 24 | 48000 | 1.0 | -6.84 | 2.8 | 0.3 | 3.10 | 6.9 |
| 102_One_Step_Closer.flac | 24 | 48000 | 1.0 | -6.56 | 3.7 | 0.3 | 3.12 | 6.6 |
| 103_With_You.flac | 24 | 48000 | 1.0 | -6.43 | 4.3 | 0.3 | 3.14 | 6.5 |
...
Contributing
This project is hosted at Codeberg and uses the default contributing features of Forgejo; issues and PRs are welcome.
For security issues and anything else I can be reached via email. You will find it in the details of my hosting account.