diff options
Diffstat (limited to 'helpers/__init__.py')
-rw-r--r-- | helpers/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/helpers/__init__.py b/helpers/__init__.py index 3b97f2f..2339b9b 100644 --- a/helpers/__init__.py +++ b/helpers/__init__.py | |||
@@ -2,6 +2,7 @@ | |||
2 | import argparse | 2 | import argparse |
3 | import sys | 3 | import sys |
4 | import os | 4 | import os |
5 | import math | ||
5 | 6 | ||
6 | class Config: | 7 | class Config: |
7 | def __init__(self, **kwargs): | 8 | def __init__(self, **kwargs): |
@@ -60,3 +61,10 @@ def duration_to_min_sec(duration): | |||
60 | return "{:2}:{:0>2}".format(minutes, seconds) | 61 | return "{:2}:{:0>2}".format(minutes, seconds) |
61 | else: | 62 | else: |
62 | return "{}:{:0>2}".format(minutes, seconds) | 63 | return "{}:{:0>2}".format(minutes, seconds) |
64 | |||
65 | def gain(volume, old_volume = None): | ||
66 | if old_volume is None: | ||
67 | return 20 * math.log10(volume / 100) | ||
68 | else: | ||
69 | return [20 * math.log10(max(volume, 0.1) / max(old_volume, 0.1)), max(volume, 0)] | ||
70 | |||