Skip to content

mcochris/Recording-analyzer

Repository files navigation

πŸ” Recording Analyzer

Bash Platform Dependency License

A Bash utility for analyzing objective characteristics of audio files (.wav, .flac, .mp3, etc.) using ffmpeg.

Provides quick, repeatable, file-level measurements for common audio metrics.

❓ Why This Tool Exists

Most tools either:

  • focus on system or room measurement (for example, REW)
  • provide raw ffmpeg output without a concise summary
  • output a single quality score

This tool fills that gap by providing:

  • quick, objective multi-metric summaries
  • a scriptable workflow for repeated analysis
  • consistent results across Linux and Windows Subsystem for Linux (WSL)
  • a way to download a spreadsheet of your music file data
  • a way to create custom playlists of your music files based on file statistics and metadata

πŸš€ Features

  • Peak level (dBFS)
  • Noise floor (dBFS)
  • Crest factor (dB)
  • Stereo correlation (phase)
  • Loudness (EBU R128: LUFS, LRA, true peak)
  • Metadata: genre, artist, album, track, duration, year, sample rate, average bit rate, and bits per sample can be displayed. recording-analyzer uses the metadata already in the file, it does not perform metadata lookups.
  • File formats supported: aac, ac3, aif, aiff, amr, caf, flac, m4a, mp3, ogg, opus, pcm, wav, wma

βœ… Requirements

The BASH shell (version 4.3 or greater), ffmpeg (version 5 or greater), and jq (version 1.7 or greater) programs must be available on your computer. On Ubuntu linux, you can install them via:

sudo apt update
sudo apt install ffmpeg jq

Bash is already installed on most Linux systems.

πŸ“¦ Installation

In these examples we assume that the directory $HOME/.local/bin exists and is in your $PATH. This is usually the case on most linux systems. Adjust as needed.

Download the file from the URL below and save it as $HOME/.local/bin/reca.sh

https://raw.githubusercontent.com/mcochris/Recording-analyzer/refs/heads/main/reca.sh

cd $HOME/.local/bin
chmod +x reca.sh

or

cd $HOME/.local/bin
curl --remote-name https://raw.githubusercontent.com/mcochris/Recording-analyzer/main/reca.sh
chmod +x reca.sh

or if you're familiar with the git version control system:

cd $HOME
git clone --depth 1 https://github.com/mcochris/Recording-analyzer.git
cd $HOME/.local/bin
ln -s $HOME/Recording-analyzer/reca.sh .
chmod +x reca.sh

πŸ†™ Updating to a new version

reca.sh may inform you that an updated version of the program is available. You can follow the installation steps above to download the new version. If you're a git user perform a "git pull" to update the repo.

▢️ Usage

NOTE: It's important to wrap your file/directory names in double quotes to handle file names containing spaces or special characters.

reca.sh "<audio_file>"

πŸ” Batch Processing Examples

Analyze every music file in the Music directory:

reca.sh "/home/user/Music"

Analyze every music file in the Music directory, including all its subdirectories:

reca.sh --recurse "~/Music"

Analyze every music file in the Music directory and get each file's metadata:

reca.sh --metadata "$HOME/Music"

Analyze every music file in the Music directory and capture the JSON results in a file. You can import the JSON file into your spreadsheet program, or upload the JSON file to https://recording-analyzer.mcochris.com/ to see your data in spreadsheet format, download the spreadsheet of your data, and create custom playlists:

reca.sh --metadata --json "/home/user/Music" > mydata.json

Command line options can be combined:

reca.sh --metadata --json --recurse "/home/user/Music"

πŸ“’ Command line options

-d, --debug       Enable debug mode to show detailed processing information
-e, --extensions  Specify a custom list of audio file extensions to analyze.
                  For example, if you supply '-e "m4a flac"' on the command
                  line, only files with the .m4a and .flac file will be
                  searched for and analyzed. The default is to search for
                  and process all the supported extension noted in the
                  "Features" section above.
-h, --help        Show a help message and exit
-j, --json        Output results in JSON format (default: human-readable text)
-l, --limit N     Limit processing to the first N audio files found
                  (default: no limit)
-m, --metadata    Include metadata fields in output
-q, --quiet       Suppress progress spinner and other non-essential output
-r, --recurse     Recursively search directories for audio files
-v, --version     Show program version and exit

πŸ–₯️ Example Output

chris@studio:~/audio$ reca.sh "Computer World.flac"

Audio Analysis: "Computer World.flac"
=====================================

Left Channel:
  Peak Level:     -0.50 dBFS
  Noise Floor:    -inf dBFS
  Crest Factor:   12.30 dB

Right Channel:
  Peak Level:     -1.05 dBFS
  Noise Floor:    -inf dBFS
  Crest Factor:   10.68 dB

Stereo Correlation:
  Average Phase:  0.4893

Loudness (EBU R128):
  Integrated Loudness:  -19.37 LUFS
  True Peak:            -0.50 dBTP
  Loudness Range:       4.00 LU

πŸ–₯️ Example Output with metadata

chris@studio:~/audio$ reca.sh --metadata "The Things We Do for Love.flac"

Audio Analysis: "The Things We Do for Love.flac"
================================================

Metadata:
  Genre:           Rock
  Artist:          10cc
  Album:           The Very Best of 10cc
  Track:           11
  Duration:        213 seconds
  Year:            1997
  Sample Rate:     44100 Hz
  Avg. Bit Rate:   887750 bps
  Bits Per Sample: 16

Left Channel:
  Peak Level:     -1.76 dBFS
  Noise Floor:    -inf dBFS
  Crest Factor:   6.29 dB

Right Channel:
  Peak Level:     -0.55 dBFS
  Noise Floor:    -inf dBFS
  Crest Factor:   6.67 dB

Stereo Correlation:
  Average Phase:  0.31

Loudness (EBU R128):
  Integrated Loudness:  -13.92 LUFS
  True Peak:            -0.53 dBTP
  Loudness Range:       4.10 LU

πŸ“– Metric Definitions

Peak Level (dBFS) Audio peak level is the highest instantaneous amplitude or loudest point in an audio signal, measured in decibels relative to full scale (dBFS). Does not include intersample peaks. It represents the maximum transient peak, not the average loudness. Ensuring peaks remain below zero is crucial to prevent digital clipping (distortion).

Noise Floor (dBFS) The noise floor in audio is the sum of all unwanted ambient sounds (HVAC, traffic) and electronic hiss (preamps, interference) present in a recording space or signal chain when no intended sound is being made. It represents the baseline "silence" of a system; a lower noise floor allows for greater dynamic range, while a high noise floor can make recordings sound unprofessional. -inf dBFS indicates digital silence or values below numerical precision.

Crest Factor (dB) Crest factor in audio is the ratio of a signal's peak amplitude to its average (RMS) power, measuring the "peakiness" or dynamic range of a sound, typically measured in dB. A higher crest factor indicates high dynamics (12–15+ dB, e.g., drums), while a lower, smaller value suggests heavy compression or a denser, more consistent sound (6–9 dB).

Stereo correlation (phase) Stereo audio average phase, often visualized via a phase correlation meter, measures the similarity between left and right channels, averaging from -1 (fully out-of-phase) to +1 (fully in-phase). A positive average (+0.1 to +1) indicates good mono compatibility, while a negative average indicates potential phase cancellation, where sounds disappear in mono.

Integrated Loudness (LUFS) Audio integrated loudness is the average loudness of the audio file in LUFS (Loudness Units Full Scale). Unlike peak meters, it calculates loudness based on human perception to ensure consistent volume levels, often targeting -14 LUFS for streaming services like Spotify or YouTube.

True Peak (dBTP) Digital audio True Peak (measured in dBTP) is a standard measurement that predicts the highest level an audio signal will reach after conversion from digital to analog, accounting for peaks between samples (inter-sample peaks). While standard digital meters (dBFS) only measure sample points, True Peak uses oversampling to detect inter-sample peaks that can cause distortion when converting to lossy formats like MP3 or AAC.

Loudness Range (LRA) Loudness Range (LRA) measures the dynamic variation between the softest and loudest parts of an audio program, quantified in Loudness Units (LU). While average loudness (integrated loudness) is typically targeted at -14 to -16 LUFS for streaming, LRA ensures audio isn't too static or too erratic, with a preferred range of 5–10 LU for consistency.

πŸ”¬ Validation

You can verify the recording-analyzer's output against programs other than ffmpeg for comparison. See methodology and verification details here:

https://github.com/mcochris/Recording-analyzer/blob/main/verification/README.md

πŸ’¬ Feedback

Comments, questions, and suggestions are welcome. You can open an issue here: https://github.com/mcochris/Recording-analyzer/issues

About

Analyze peak level, noise floor, dynamic range, crest factor, stereo correlation, and loudness of an audio file.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Contributors