-
Notifications
You must be signed in to change notification settings - Fork 39
/
stemcheck.py
61 lines (41 loc) · 1.12 KB
/
stemcheck.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python3
# Stemcheck lets you check the integrity of a stem file
# Installation:
# `python3 -m pip install ffmpeg-python`
# Usage:
# `python3 stemcheck.py track.stem.m4a`
import argparse
import subprocess
from stempeg.read import Info, read_stems
from os import path as op
import os
def stemsep(
stems_file,
outdir=None,
extension="aiff",
idx=None,
start=None,
duration=None,
check=True,
):
print("Reading stem file...")
info = Info(stems_file)
S, sr = read_stems(
stems_file, stem_id=idx, start=start, duration=duration, check=check
)
if check:
print("Done. Integrity check succeeded!")
return
print("Done!")
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--version", "-v", action="version", version="1.0.0")
parser.add_argument("filename", metavar="filename", help="Input STEM file")
parser.add_argument("--check", action="store_true", help="Run an integrity check")
args = parser.parse_args()
stemsep(
args.filename,
args.check,
)
if __name__ == "__main__":
main()