-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclip-detector.py
More file actions
50 lines (43 loc) · 1.63 KB
/
Copy pathclip-detector.py
File metadata and controls
50 lines (43 loc) · 1.63 KB
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
""" Checks SpecDrum audio blocks for clipping (integer overflow) """
import sys
from argparse import ArgumentParser
from lib import libtzxtools as tzx
group1Sample1 = bytearray()
group2Sample1 = bytearray()
group2Sample2 = bytearray()
group2Sample3 = bytearray()
group3Sample1 = bytearray()
group3Sample2 = bytearray()
group3Sample3 = bytearray()
group3Sample4 = bytearray()
group_samples = [[group2Sample1, 3072],
[group2Sample2, 3072],
[group2Sample3, 3072],
[group3Sample1, 2048],
[group3Sample2, 2048],
[group3Sample3, 3072],
[group3Sample4, 3072],
[group1Sample1, 2048]]
drum_names = ["group1Sample1",
"group2Sample1",
"group2Sample2",
"group2Sample3",
"group3Sample1",
"group3Sample2",
"group3Sample3",
"group3Sample4"]
parser = ArgumentParser()
parser.add_argument("fileName", help="Open specified file")
args = parser.parse_args()
audio_block_path = args.fileName
if audio_block_path is None:
print("No input file specified. Please specify a file")
sys.exit()
tzx.verify_file(audio_block_path, "audio")
group_samples = tzx.assign_samples(audio_block_path, group_samples)
for sample1 in group_samples[0:3]:
for sample2 in group_samples[4:7]:
for i, drum_name in enumerate(drum_names[1:4]):
clip_count = 0
clip_count += tzx.detect_clips(group_samples[7][0], sample1[0], sample2[0], drum_names[0].strip(), drum_name.strip(), drum_names[i+4].strip())
print("{} clips found".format(clip_count))