-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.py
183 lines (177 loc) · 6.14 KB
/
utils.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
from pypinyin import pinyin
import shutil
import os
def move_file(folders, datasets, uids, result):
for folder in folders:
if folder.split("/")[-1].split("_")[-1] == "gt":
setting = "gt"
elif "no_casting" in folder:
setting = "mscqtd_none"
elif "mscqtd" in folder:
setting = "mscqtd"
else:
setting = "orig"
for i, (dataset, uid) in enumerate(zip(datasets, uids)):
if setting == "gt" or setting == "gt_speech":
old_file = folder + "/{}".format(dataset) + "/{}.wav".format(uid)
else:
old_file = folder + "/{}".format(dataset) + "/{}_pred.wav".format(uid)
if "speech" in setting:
setting = setting.split("_")[0]
new_file = result + "/{}_{}.wav".format(i + 1, setting)
print(old_file)
print(new_file)
shutil.copyfile(old_file, new_file)
def get_pinyin(lyric):
results = pinyin(lyric)
ans = []
for result in results:
ans.append(result[0])
return " ".join(ans)
if __name__ == "__main__":
### Seen
# datasets = [
# "opencpopbeta",
# "opencpopbeta",
# "m4singer",
# "m4singer",
# "m4singer",
# ]
# uids = [
# "1044003410",
# "1092002291",
# "Alto-1_美错_0014",
# "Bass-1_十年_0008",
# "Soprano-2_同桌的你_0018",
# ]
# folders = [
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_orig",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_msstftd",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_mscqtd",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_merge",
# ]
# result = "D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/effectiveness"
### Unseen
# datasets = [
# "popcs",
# "popcs",
# "opensinger",
# "opensinger",
# "opensinger",
# ]
# uids = [
# "明天会更好_0016",
# "隐形的翅膀_0009",
# "Man_21_丑八怪_8",
# "Man_0_大鱼_19",
# "Woman_40_易燃易爆炸_12",
# ]
# folders = [
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_orig",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_msstftd",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_mscqtd",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_merge",
# ]
# result = "D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/effectiveness"
# move_file(folders, datasets, uids, result)
### Seen
# datasets = [
# "ljspeech",
# "libritts",
# "libritts",
# "libritts",
# "ljspeech",
# ]
# uids = [
# "LJ001-0051",
# "233_155990_233_155990_000006_000007",
# "233_155990_233_155990_000007_000006",
# "696_92939_696_92939_000002_000000",
# "LJ006-0009",
# ]
# folders = [
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt_speech",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_orig_speech",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_msstftd_speech",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_mscqtd_speech",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/hifigan_merge_speech",
# ]
# result = "D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/effectiveness"
# move_file(folders, datasets, uids, result)
### Unseen
# datasets = [
# "opensinger",
# "opensinger",
# "opensinger",
# ]
# uids = [
# "Man_0_大鱼_15",
# "Woman_39_mojito_10",
# "Woman_40_易燃易爆炸_25",
# ]
# folders = [
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/melgan_orig",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/melgan_merge",
# ]
# result = "D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/generalization/melgan"
# move_file(folders, datasets, uids, result)
### Seen
# datasets = [
# "m4singer",
# "opencpopbeta",
# "m4singer",
# ]
# uids = [
# "Alto-1_美错_0010",
# "1092002304",
# "Bass-1_十年_0001",
# ]
# folders = [
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/nsfhifigan_orig",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/nsfhifigan_merge",
# ]
# result = "D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/generalization/nsfhifigan"
# move_file(folders, datasets, uids, result)
### Unseen
# datasets = [
# "popcs",
# "opensinger",
# "popcs",
# ]
# uids = [
# "隐形的翅膀_0004",
# "Man_0_大鱼_12",
# "虫儿飞_0001",
# ]
# folders = [
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/nsfhifigan_orig",
# "D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/nsfhifigan_merge",
# ]
# result = "D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/generalization/nsfhifigan"
### Ablation
datasets = [
"opencpop",
"opencpop",
"opencpop",
]
uids = [
"2044001646",
"2086003180",
"2093003455",
]
folders = [
"D:/Study/CUHKSZ/Research_Group/ICASSP2024/tmp/gt",
"D:/Study/CUHKSZ/Research_Group/ICASSP2024/ablasion_hifigan",
"D:/Study/CUHKSZ/Research_Group/ICASSP2024/ablasion_hifigan_mscqtd",
"D:/Study/CUHKSZ/Research_Group/ICASSP2024/ablasion_hifigan_mscqtd_no_casting",
]
result = (
"D:/Study/CUHKSZ/Research_Group/ICASSP2024/MS-SB-CQTD/assets/audios/ablation"
)
move_file(folders, datasets, uids, result)
# print(get_pinyin("为我撩人,还为我双眸失神"))