audio_helper.cli_argparse module

Audio Helper — argparse-based command-line interface.

Thin wrapper around the pure functions in audio_helper.main that exposes the whole toolkit as subcommands under a single audio-helper entry point. Written with argparse from the standard library so the CLI works out of the box on any Python install that has the package installed — no extra dependency required.

Subcommands

  • convert — re-encode an audio file (sample rate / channels / codec)

  • duration — print the duration in seconds of an audio file

  • chunk — extract [start, end] slice from an audio file

  • silence — write a silent audio file of a given duration

  • concat — concatenate several audio files head-to-tail

  • roomtone — mix pink/white/brown ambient noise onto a speech track

  • split — split an audio file into fixed-duration chunks

  • separate — run Demucs source separation (needs the [demucs] extra)

  • resemblance — MFCC-based similarity score between two audio files

Usage Example

>>> #   audio-helper convert    --input in.mp3 --output out.wav --freq 44100
>>> #   audio-helper duration   --input in.mp3
>>> #   audio-helper split      --input in.mp3 --output-dir chunks/ --seconds 30
>>> #   audio-helper concat     --inputs a.mp3 b.mp3 c.mp3 --output out.mp3
>>> #   audio-helper silence    --duration 5 --output silence.wav
>>> #   audio-helper roomtone   --input speech.wav --output speech-rt.wav --db -42
>>> #   audio-helper chunk      --input in.mp3 --start 3.0 --end 8.5 --output cut.mp3
>>> #   audio-helper separate   --input mix.mp3 --output-dir stems/
>>> #   audio-helper resemblance --a a.mp3 --b b.mp3

Author

Warith Harchaoui, Ph.D. — https://linkedin.com/in/warith-harchaoui/

audio_helper.cli_argparse.build_parser()[source]

Assemble the top-level audio-helper argument parser.

Returns:

Fully wired parser with every subcommand attached.

Return type:

argparse.ArgumentParser

audio_helper.cli_argparse.main(argv=None)[source]

Entry point invoked by audio-helper (see [project.scripts]).

Parameters:

argv (sequence of str, optional) – Arguments to parse. Defaults to sys.argv[1:] when None.

Returns:

Process exit code (0 on success).

Return type:

int