Metadata-Version: 2.1
Name: harmonizer
Version: 0.1.1
Summary: Harmonizes your audio media: converts, normalizes, enriches and validates.
Home-page: http://github.com/alafanechere/harmonizer
Author: Augustin Lafanechere
Author-email: augustin.lafanechere@gmail.com
License: GPLv3+
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Multimedia :: Sound/Audio
Classifier: Topic :: Multimedia :: Sound/Audio :: Analysis
Classifier: Topic :: Multimedia :: Sound/Audio :: Editors
Classifier: Topic :: Multimedia :: Sound/Audio :: Conversion
Description-Content-Type: text/markdown
Requires-Dist: eyeD3 (==0.8.10)
Requires-Dist: pydub (==0.23.1)
Requires-Dist: pyacoustid (==1.1.5)
Requires-Dist: mutagen (==1.42.0)
Requires-Dist: discogs-client (==2.2.2)
Requires-Dist: spotipy (==2.4.4)
Requires-Dist: titlecase (==0.12.0)
Requires-Dist: click (==7.0)
Requires-Dist: pyyaml (==5.1)
Requires-Dist: logme (==1.3.2)
Requires-Dist: schema (==0.7.0)

# HARMONIZER
[![PyPI version](https://badge.fury.io/py/harmonizer.svg)](https://badge.fury.io/py/harmonizer)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/harmonizer.svg)

This library helps you to **convert**, **normalize**, **enrich** and **validate** your music library.
It fullfills the need we have at [imr.party](https://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](https://acoustid.org/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](https://www.discogs.com/developers/)
    * Use Spotify API to find the audio track in their catalog. Get your API secrets [here](https://developer.spotify.com/documentation/web-api/)
* **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](./examples/metadata_output.json))
* A cover art image file if present in the original file

## Install
### System dependency
You need to have **ffmpeg** on your system :

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

### Pip
`$ pip install harmonizer`

## CLI usage
```bash
Usage: harmonizer [OPTIONS] AUDIO_INPUT_DIR AUDIO_OUTPUT_DIR

  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.
  -c, --conf FILE       Path to your Harmonizer YAML configuration.
  --help                Show this message and exit.

```
## Config file structure
Checkout [example_config.yml](./example_config.yml).

## Test
`$ python setup.py test`

## TODO:
* Docstrings
* More documentation
* Better discogs search and match algorithm
* More pipeline control through the config


