File size: 323 Bytes
719b8f9
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import math

import fire
from pydub import AudioSegment


def reduce_volume(src_path, dst_path, volume_ratio):
    audio = AudioSegment.from_file(src_path)
    vol_change = 20 * math.log10(volume_ratio)
    quieter = audio + vol_change
    quieter.export(dst_path)


if __name__ == "__main__":
    fire.Fire(reduce_volume)