George
commited on
Commit
•
4347ab7
1
Parent(s):
e2701c5
upl all codes
Browse files- .gitignore +2 -0
- README.md +12 -2
- chest_falsetto.py +112 -0
- data/client_data.zip +3 -0
.gitignore
ADDED
@@ -0,0 +1,2 @@
|
|
|
|
|
|
|
1 |
+
rename.sh
|
2 |
+
test.py
|
README.md
CHANGED
@@ -104,8 +104,18 @@ This dataset card aims to be a base template for new datasets. It has been gener
|
|
104 |
[More Information Needed]
|
105 |
|
106 |
### Citation Information
|
107 |
-
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
### Contributions
|
111 |
|
|
|
104 |
[More Information Needed]
|
105 |
|
106 |
### Citation Information
|
107 |
+
```
|
108 |
+
@dataset{zhaorui_liu_2021_5676893,
|
109 |
+
author = {Zhaorui Liu, Monan Zhou, Shenyang Xu and Zijin Li},
|
110 |
+
title = {{Music Data Sharing Platform for Computational Musicology Research (CCMUSIC DATASET)}},
|
111 |
+
month = nov,
|
112 |
+
year = 2021,
|
113 |
+
publisher = {Zenodo},
|
114 |
+
version = {1.1},
|
115 |
+
doi = {10.5281/zenodo.5676893},
|
116 |
+
url = {https://doi.org/10.5281/zenodo.5676893}
|
117 |
+
}
|
118 |
+
```
|
119 |
|
120 |
### Contributions
|
121 |
|
chest_falsetto.py
ADDED
@@ -0,0 +1,112 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import os
|
2 |
+
import random
|
3 |
+
import datasets
|
4 |
+
from datasets.tasks import AudioClassification
|
5 |
+
|
6 |
+
|
7 |
+
# Once upload a new piano brand, please register its name here
|
8 |
+
_NAMES = ['m_chest', 'f_chest', 'm_falsetto', 'f_falsetto']
|
9 |
+
|
10 |
+
_DBNAME = os.path.basename(__file__).split('.')[0]
|
11 |
+
|
12 |
+
_HOMEPAGE = "https://huggingface.co/datasets/ccmusic-database/" + _DBNAME
|
13 |
+
|
14 |
+
_CITATION = """\
|
15 |
+
@dataset{zhaorui_liu_2021_5676893,
|
16 |
+
author = {Zhaorui Liu, Monan Zhou, Shenyang Xu and Zijin Li},
|
17 |
+
title = {{Music Data Sharing Platform for Computational Musicology Research (CCMUSIC DATASET)}},
|
18 |
+
month = nov,
|
19 |
+
year = 2021,
|
20 |
+
publisher = {Zenodo},
|
21 |
+
version = {1.1},
|
22 |
+
doi = {10.5281/zenodo.5676893},
|
23 |
+
url = {https://doi.org/10.5281/zenodo.5676893}
|
24 |
+
}
|
25 |
+
"""
|
26 |
+
|
27 |
+
_DESCRIPTION = """\
|
28 |
+
This database contains 1280 monophonic singing audio (.wav format) of chest and falsetto voices,
|
29 |
+
with chest voice tagged as _chest and falsetto voice tagged as _falsetto. In addition,
|
30 |
+
the Mel-spectrogram, MFCC, and spectral characteristics of each audio segment are also included,
|
31 |
+
for a total of 5120 CSV files.
|
32 |
+
"""
|
33 |
+
|
34 |
+
_URL = _HOMEPAGE + "/resolve/main/data/client_data.zip"
|
35 |
+
|
36 |
+
|
37 |
+
class chest_falsetto(datasets.GeneratorBasedBuilder):
|
38 |
+
|
39 |
+
def _info(self):
|
40 |
+
return datasets.DatasetInfo(
|
41 |
+
features=datasets.Features(
|
42 |
+
{
|
43 |
+
"audio": datasets.Audio(sampling_rate=44_100),
|
44 |
+
"label": datasets.features.ClassLabel(names=_NAMES),
|
45 |
+
"gender": datasets.Value("string"),
|
46 |
+
"singing_method": datasets.Value("string"),
|
47 |
+
}
|
48 |
+
),
|
49 |
+
supervised_keys=("audio", "label"),
|
50 |
+
homepage=_HOMEPAGE,
|
51 |
+
license="mit",
|
52 |
+
citation=_CITATION,
|
53 |
+
description=_DESCRIPTION,
|
54 |
+
task_templates=[
|
55 |
+
AudioClassification(
|
56 |
+
task="audio-classification",
|
57 |
+
audio_column="audio",
|
58 |
+
label_column="label",
|
59 |
+
)
|
60 |
+
],
|
61 |
+
)
|
62 |
+
|
63 |
+
def _split_generators(self, dl_manager):
|
64 |
+
data_files = dl_manager.download_and_extract(_URL)
|
65 |
+
files = dl_manager.iter_files([data_files])
|
66 |
+
trainset, validationset, testset = [], [], []
|
67 |
+
|
68 |
+
for _, path in enumerate(files):
|
69 |
+
trainset.append(path)
|
70 |
+
|
71 |
+
random.shuffle(trainset)
|
72 |
+
data_count = len(trainset)
|
73 |
+
p80 = int(data_count * 0.8)
|
74 |
+
p90 = int(data_count * 0.9)
|
75 |
+
validationset = trainset[p80:p90]
|
76 |
+
testset = trainset[p90:]
|
77 |
+
trainset = trainset[:p80]
|
78 |
+
|
79 |
+
return [
|
80 |
+
datasets.SplitGenerator(
|
81 |
+
name=datasets.Split.TRAIN,
|
82 |
+
gen_kwargs={
|
83 |
+
"files": trainset,
|
84 |
+
},
|
85 |
+
),
|
86 |
+
datasets.SplitGenerator(
|
87 |
+
name=datasets.Split.VALIDATION,
|
88 |
+
gen_kwargs={
|
89 |
+
"files": validationset,
|
90 |
+
},
|
91 |
+
),
|
92 |
+
datasets.SplitGenerator(
|
93 |
+
name=datasets.Split.TEST,
|
94 |
+
gen_kwargs={
|
95 |
+
"files": testset,
|
96 |
+
},
|
97 |
+
),
|
98 |
+
]
|
99 |
+
|
100 |
+
def _generate_examples(self, files):
|
101 |
+
for i, path in enumerate(files):
|
102 |
+
file_name = os.path.basename(path)
|
103 |
+
if file_name.endswith(".wav"):
|
104 |
+
sex = file_name.split('_')[1]
|
105 |
+
gender = 'male' if sex == 'm' else 'female'
|
106 |
+
method = file_name.split('_')[2][:-4]
|
107 |
+
yield i, {
|
108 |
+
"audio": path,
|
109 |
+
"label": sex + '_' + method,
|
110 |
+
"gender": gender,
|
111 |
+
"singing_method": method,
|
112 |
+
}
|
data/client_data.zip
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:82a14d2259d441db6c84a9a4417468da6b5bcd89b3e95cb5c28e829fa12222f7
|
3 |
+
size 39271503
|