Datasets:

Modalities:
Text
Formats:
json
Size:
< 1K
License:
admin commited on
Commit
fb8966f
·
1 Parent(s): 6abc4c7
Files changed (3) hide show
  1. .gitignore +2 -0
  2. README.md +27 -0
  3. soundfonts.py +75 -0
.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ test.*
2
+ *__pycache__*
README.md CHANGED
@@ -1,3 +1,30 @@
1
  ---
2
  license: cc-by-nc-nd-4.0
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: cc-by-nc-nd-4.0
3
+ viewer: false
4
  ---
5
+
6
+ # Intro
7
+ The SF Soft Soundfont Dataset is a comprehensive sample library designed for intelligent music synthesis and digital audio workstation (DAW) development, featuring a diverse collection of high-quality instrument sounds spanning multiple categories including piano, strings, woodwinds, brass, percussion, electronic synthesizers, and ethnic instruments, while supporting both mainstream soundfont formats: SF2, which utilizes uncompressed PCM storage to ensure maximum fidelity and tonal authenticity, and SF3, which employs Ogg Vorbis compression to achieve reduced file sizes and faster loading times; each soundfont is accompanied by structured metadata encompassing instrument classification, pitch range, sample rate, polyphony count, velocity layering, and loop markers, enabling advanced applications such as automatic arrangement, real-time performance, timbre transfer, and cross-platform sequencer development, making it well-suited for mobile music applications, game audio engines, and AI-driven composition systems to facilitate high-fidelity, low-latency intelligent music generation experiences.
8
+
9
+ ## Usage
10
+ ```python
11
+ from datasets import load_dataset
12
+
13
+ ds = load_dataset(
14
+ "Genius-Society/soundfonts",
15
+ split="train",
16
+ cache_dir="./__pycache__",
17
+ trust_remote_code=True,
18
+ )
19
+ for item in ds:
20
+ print(item)
21
+ ```
22
+
23
+ ## Maintenance
24
+ ```bash
25
+ git clone git@hf.co:datasets/Genius-Society/soundfonts
26
+ cd soundfonts
27
+ ```
28
+
29
+ ## Mirror
30
+ <https://www.modelscope.cn/datasets/Genius-Society/soundfonts>
soundfonts.py ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import os
2
+ import random
3
+ import requests
4
+ import datasets
5
+ from tqdm import tqdm
6
+
7
+ _DOMAIN = "https://www.modelscope.cn"
8
+
9
+ _URL = f"{_DOMAIN}/datasets/Genius-Society/{os.path.basename(__file__)[:-3]}"
10
+
11
+
12
+ class soundfonts(datasets.GeneratorBasedBuilder):
13
+ def _info(self):
14
+ return datasets.DatasetInfo(
15
+ features=datasets.Features(
16
+ {
17
+ "soundfont": datasets.Value("string"),
18
+ "name": datasets.Value("string"),
19
+ "format": datasets.Value("string"),
20
+ }
21
+ ),
22
+ supervised_keys=("soundfont", "format"),
23
+ homepage=_URL,
24
+ license="mit",
25
+ version="0.0.1",
26
+ )
27
+
28
+ def _get_files(
29
+ self,
30
+ root: str,
31
+ url=f"{_DOMAIN}/api/v1/datasets/167741/repo/tree",
32
+ page_size=50,
33
+ ):
34
+ try:
35
+ response = requests.get(
36
+ url,
37
+ params={
38
+ "Revision": "master",
39
+ "Root": root,
40
+ "PageNumber": 1,
41
+ "PageSize": page_size,
42
+ },
43
+ )
44
+ response.raise_for_status()
45
+ return response.json()["Data"]["Files"]
46
+
47
+ except Exception as e:
48
+ print(f"{e}, retrying...")
49
+ return self._get_files(root)
50
+
51
+ def _split_generators(self, _):
52
+ dataset = []
53
+ files = self._get_files("data")
54
+ for file in tqdm(files, desc="Parsing soundfonts"):
55
+ fname, ext = os.path.splitext(file["Name"])
56
+ dataset.append(
57
+ {
58
+ "soundfont": f"{_URL}/resolve/master/" + file["Path"],
59
+ "name": str(fname).strip(),
60
+ "format": str(ext).strip()[1:].upper(),
61
+ }
62
+ )
63
+
64
+ random.shuffle(dataset)
65
+
66
+ return [
67
+ datasets.SplitGenerator(
68
+ name=datasets.Split.TRAIN,
69
+ gen_kwargs={"files": dataset},
70
+ )
71
+ ]
72
+
73
+ def _generate_examples(self, files):
74
+ for i, path in enumerate(files):
75
+ yield i, path