1
0
Fork 0
forked from fkobi/sd2
Audio analysis tool
  • Zig 99.4%
  • Shell 0.6%
Find a file
fkobi 88e6d6a34e Release 1.0.0
Required for my thesis paper

Signed-off-by: fkobi <fkobi@fsfe.org>
2026-01-18 14:39:14 +01:00
LICENSES Release 1.0.0 2026-01-18 14:39:14 +01:00
scripts Release 1.0.0 2026-01-18 14:39:14 +01:00
src Release 1.0.0 2026-01-18 14:39:14 +01:00
.gitignore Release 1.0.0 2026-01-18 14:39:14 +01:00
build.zig Release 1.0.0 2026-01-18 14:39:14 +01:00
build.zig.zon Release 1.0.0 2026-01-18 14:39:14 +01:00
README.org Release 1.0.0 2026-01-18 14:39:14 +01:00
REUSE.toml Release 1.0.0 2026-01-18 14:39:14 +01:00

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_time enables human readable timestamps in reports
  • small_float enbles 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.