diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..7a8a472 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +* +!mg_cli.py +!requirements.txt diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..a08cbb1 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,7 @@ +FROM python:3.9-slim + +RUN apt-get update && apt-get install -y libsndfile1 ffmpeg && rm -rf /var/lib/apt/lists/* +COPY requirements.txt mg_cli.py /app/ +RUN cd /app && pip install --no-cache-dir -r requirements.txt +WORKDIR /data +ENTRYPOINT ["python3", "/app/mg_cli.py"] diff --git a/README.md b/README.md index d33ac94..39de32a 100644 --- a/README.md +++ b/README.md @@ -75,7 +75,7 @@ And then: ``` usage: mg_cli.py [-h] [-b {16,24,32}] [--log LOG] [--no_limiter] - [--dont_normalize] + [--dont_normalize] [-r INTERNAL_SAMPLE_RATE] target reference result Simple Matchering 2.0 Command Line Application @@ -94,8 +94,22 @@ optional arguments: --no_limiter Disables the limiter at the final stage of processing --dont_normalize Disables normalization, if --no_limiter is set. Can cause clipping if the bit depth is not 32 + -r INTERNAL_SAMPLE_RATE, --internal-sample-rate INTERNAL_SAMPLE_RATE + Set the internal sample rate (default: 44100 Hz) ``` +## Docker Usage + +1. Clone the repository. +2. Put your track and reference file to `./var` directory. +3. Execute: +4. +```bash +docker run -v "$PWD/var:/data" --rm $(docker build . -q) track.wav ref.wav mastered.wav --internal-sample-rate 48000 +``` + +You may adjust `-v` value to any directory with your track and reference files. + ### Visit **[Matchering main repo][matchering]** to learn more about it! ## A Coffee diff --git a/mg_cli.py b/mg_cli.py index 02be511..d42f666 100644 --- a/mg_cli.py +++ b/mg_cli.py @@ -12,6 +12,7 @@ """ import matchering as mg +from matchering import Config from argparse import ArgumentParser import logging import sys @@ -51,6 +52,13 @@ def parse_args(): help="Disables normalization, if --no_limiter is set. " "Can cause clipping if the bit depth is not 32", ) + parser.add_argument( + "-r", + "--internal-sample-rate", + type=int, + default=44100, + help="Set the internal sample rate (default: 44100 Hz)", + ) return parser.parse_args() @@ -87,9 +95,13 @@ def run(args, logger): logger.debug(f'Contributors: {", ".join(mg.__credits__)}') try: + config = Config() + config.internal_sample_rate = args.internal_sample_rate + mg.process( target=args.target, reference=args.reference, + config=config, results=[ mg.Result( args.result,