-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1.getTrainData.py
53 lines (43 loc) · 1.39 KB
/
1.getTrainData.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
#test read midi files
from utils import *
# def printChordToFiles(components):
# startPiano = False
# for component in components:
# if component.names['en'][0] == 'Piano':
# startPiano = True
# if type(component) is music21.chord.Chord:
import os
# for file in os.listdir("data/MIDI"):
# if file.endswith(".mid"):
# path = os.path.join("data/MIDI", file)
# print(path)
# printPianoChordSequence(path)
#components= readMidiFile('data/LetItBe.mid')
# path = 'data/Imagine.mid'
# printPianoChordSequence(path)
#printPianoChord(path.split(".mid")[0] + "_chord.txt")
import os
# extract train
type = "train"
for file in os.listdir("data/CHORDS/"+type):
if file.endswith(".txt"):
path = os.path.join("data/CHORDS/"+type, file)
print(path)
#extractNodeChord(path, None)
extractNodeChord(path, 20, type)
# extract dev
type = "test"
for file in os.listdir("data/CHORDS/"+type):
if file.endswith(".txt"):
path = os.path.join("data/CHORDS/"+type, file)
print(path)
#extractNodeChord(path, None)
extractNodeChord(path, 20, type)
# extract test
type = "dev"
for file in os.listdir("data/CHORDS/"+type):
if file.endswith(".txt"):
path = os.path.join("data/CHORDS/"+type, file)
print(path)
#extractNodeChord(path, None)
extractNodeChord(path, 20, type)