-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcheck_files.py
51 lines (42 loc) · 1.39 KB
/
check_files.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
import argparse
import yaml
import os
def parse_all_takes(yamlfile, datadir):
stream = open(yamlfile, 'r')
y = yaml.load(stream)
datadir = datadir
for pitch in y[0]['Pitches']:
for rec in pitch['recordings']:
for per in rec['performer']:
for take in per['takes']:
yield (
pitch['note'],
rec['expression'],
rec['vibrato'],
per['experience'],
os.path.join(datadir, take['audio']),
os.path.join(datadir, take['sensor'])
)
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='Perform pitch estimation for given sensor data file.')
parser.add_argument(dest='yamlfile', type=str, default=None,
help='YAML File')
parser.add_argument(dest='muserpath', type=str, default=None,
help='Path to MUSERC dataset')
args = parser.parse_args()
for (
pitch,
expression,
has_vibrato,
experience,
faudio,
fsensor
) in parse_all_takes(
args.yamlfile,
args.muserpath,
):
if not os.path.exists(faudio):
print "%s is missing" % faudio
if not os.path.exists(fsensor):
print "%s is missing" % fsensor