#!/usr/bin/python3 # -*- coding: utf-8 -*- import argparse from pydub import AudioSegment from project_settings import project_path def get_args(): parser = argparse.ArgumentParser() parser.add_argument( "--filename", default=(project_path / "data/examples/audio_0_3_clone_from_audio_0_2.wav").as_posix(), type=str, ) parser.add_argument( "--reference", default=(project_path / "data/examples/audio_0_2.wav").as_posix(), type=str, ) parser.add_argument( "--output_file", default="temp.wav", type=str, ) args = parser.parse_args() return args def main(): args = get_args() sound1 = AudioSegment.from_wav(args.filename) sound2 = AudioSegment.from_wav(args.reference) sound1_ = sound1.apply_gain(sound2.dBFS - sound1.dBFS) sound1_.export( args.output_file, format="wav" ) return if __name__ == "__main__": main()