-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
39 lines (29 loc) · 1.33 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import sys
import argparse
import logging
from utils import main
import log_util
log = logging.getLogger(__name__)
def parse_args():
parser = argparse.ArgumentParser()
parser.add_argument('-a', '--audio', dest='audio', type=str,
help='Path to audio file')
parser.add_argument('-p', '--pitch', dest='pitch', type=int,
help='Number of semitones by which the trace will be altered (+1, -1, ...)')
parser.add_argument('-s', '--split', dest='split', action='store_true',
help='Whether to split audio file')
parser.add_argument('-f', '--format', dest='format', type=str,
help='Output format of the audio file if you want to transcode it')
parser.add_argument('-o', '--output', dest='output', type=str,
help='Output path (default: /output)')
parser.set_defaults(output='output')
parser.add_argument('-d', '--debug', dest='debug', action='store_true',
help='Debug mode')
return parser.parse_args()
if __name__ == '__main__':
args = parse_args()
log_util.configure_logging(__package__, logging.DEBUG if args.debug else None)
if args.audio is None:
print('Use: python -h')
sys.exit()
main(args.audio, args.pitch, args.split, args.format, args.output)