Skip to main content

HARMONIZER

PyPI version PyPI - Python Version

This library helps you to convert, normalize, enrich and validate your music library. It fullfills the need we have at imr.party to harmonize the music library of our webradio.

The library comes shipped with a CLI tools which allow you to process audio files in a directory to create normalized mp3 versions of all files, enrich their metadata from various sources (Discogs, Spotify).

What it does

  • Audio conversion: Converts FLAC, MP3, AAC (m4a) to MP3 (128k, 192k, 320k).
  • Audio normalization: Peak normalize your input audio. Normalization is expressed in headroom ratio (0.1 means max peak will me 90% of the maximum volume).
  • Metadata extraction :
    • Audio tags: extracted from the audio and written to the JSON metadata results.
    • Audio fingerprinting: Chromaprint fingerprinting extracted from the audio and written to the JSON metadata results.
  • Metadata enrichment:
    • Use Discogs API to find the releases related to the audio track. Get your tokens here
    • Use Spotify API to find the audio track in their catalog. Get your API secrets here
  • Covert Art extraction (MP3 only) : extract the covert art to an image file.
  • Validation : run various integrity check to assert the input audio respects the rules you defined in the your config.
    • Minimum input bit rate (MP3 only)
    • Mandatory audio tags
    • Accepted input mime types

Outputs

All file processing will create 2 or 3 files :

  • The mp3 converted and normalized audio version of the input audio file.
  • A metadata json file (check metadata_output.json)
  • A cover art image file if present in the original file

Install

System dependency

ffmpeg:
OS X : $ brew install ffmpeg
Linux: $ sudo apt install ffmpeg

libmagic:
OS X : $ brew install libmagic
Linux: $ sudo apt install libmagic-dev

fpcalc:
Install Chromaprint and add the executable to your path.

Pip

$ pip install harmonizer

CLI usage

Usage: cli.py [OPTIONS] AUDIO_INPUT_DIR AUDIO_OUTPUT_DIR CONF

  Please provide an audio_input_dir path and an audio_output_dir path to
  launch harmonization of your files.

Options:
  --json-out DIRECTORY  Path to directory to which  JSON metadata will be
                        written to.
  --img-out DIRECTORY   Path to directory to which extracted cover arts will
                        be written to.
  --help                Show this message and exit.

Config file structure

Checkout example_config.yml.

Test

$ python setup.py test

TODO:

  • Docstrings
  • More documentation
  • Better discogs search and match algorithm
  • More pipeline control through the config

Metadata

Release files for harmonizer 0.1.31

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for harmonizer 0.1.31
File Size Uploaded
harmonizer-0.1.31.tar.gz 21.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for harmonizer 0.1.31
File Interpreter ABI Platform
harmonizer-0.1.31-py3-none-any.whl Python 3 none any Details

Total release size: 44.0 kB

Release files / harmonizer-0.1.31.tar.gz

Download URL harmonizer-0.1.31.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a70c121230769db09be1b68c2f5e9f64b645ca913723c0415e7478eab86e794a
BLAKE2b-256 checksum
How to use checksums
a4850643507dac598d05de2c64359f6326056ff03aae98ab9aea75c94e43cc4b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.8

Release files / harmonizer-0.1.31-py3-none-any.whl

Download URL harmonizer-0.1.31-py3-none-any.whl
Size 22.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3c81f3f5e46bf8ce026745443927d32f9f43d8cfd0f66e290ca2cf877e84935a
BLAKE2b-256 checksum
How to use checksums
1decafe889a285af75e3206aad18a8cff4394e4011757031fe87a505f65b8c68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.31.1 CPython/3.6.8

Release history Release notifications | RSS feed

This release

0.1.31 This release

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page