File size: 1,236 Bytes
162fa19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
from pathlib import Path


def midi_explorer(dataset, path):  # path(str)->paths(list)
    if dataset == "lakh":
        return list(Path(path).glob("*.mid"))

    if dataset == "lakh_matched":
        return list(Path(path).rglob("*.mid"))

    if dataset == "guitarset":
        return list(Path(path).glob("*.jams"))

    if dataset == "maestro":
        files = []
        with open(path.split(",")[0] + "/maestro-v3.0.0.csv", "r", encoding="utf-8") as file:
            reader = csv.reader(file)
            next(reader)
            for row in reader:
                if row[2] == path.split(",")[1]:
                    files.append(path.split(",")[0] + "/" + row[4])
        return files
    if dataset == "slakh":
        return list(Path(path).glob("**/MIDI/*.mid"))
    if dataset == "molina":
        return list(Path(path).glob("*.GroundTruth.txt"))
    if dataset == "phenicx":
        return list(Path(path).glob("*.mid"))

    if dataset == "urmp":
        return list(Path(path).rglob("Notes*.txt"))

    if dataset == "gaps":
        return list(Path(path).glob("*.mid"))

    if dataset == "other":
        return list(Path(path).glob("*.mid"))

    if dataset == "maps":
        return list(Path(path).glob("*.txt"))