jg583 commited on
Commit
1abedf6
1 Parent(s): 859cc41
Files changed (2) hide show
  1. NSynth.py +6 -3
  2. README.md +44 -0
NSynth.py CHANGED
@@ -19,7 +19,7 @@ The NSynth dataset is an audio dataset containing over 300,000 musical notes acr
19
  This dataset was created as an attempt to establish a high-quality entry point into audio machine learning, in response to the surge of breakthroughs in generative modeling of images due to the abundance of approachable image datasets (MNIST, CIFAR, ImageNet). NSynth is meant to be both a benchmark for audio ML and a foundation to be expanded on with future datasets.
20
  """
21
 
22
- _HOMEPAGE = "https://magenta.tensorflow.org/datasets/nsynth#note-qualities"
23
 
24
  _LICENSE = "Creative Commons Attribution 4.0 International (CC BY 4.0)"
25
 
@@ -43,6 +43,7 @@ class NSynth(datasets.GeneratorBasedBuilder):
43
  "instrument_source_str": datasets.Value("string"),
44
  "audio": datasets.features.Audio()
45
  })
 
46
  return datasets.DatasetInfo(
47
  description=_DESCRIPTION,
48
  features=features,
@@ -50,12 +51,13 @@ class NSynth(datasets.GeneratorBasedBuilder):
50
  license=_LICENSE,
51
  citation=_CITATION,
52
  )
 
53
  def _split_generators(self, dl_manager):
54
  dl_paths = dl_manager.download_and_extract({
55
  'train': 'http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-train.jsonwav.tar.gz',
56
  'validation': 'http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-valid.jsonwav.tar.gz',
57
  'test': 'http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-test.jsonwav.tar.gz',
58
- })
59
  return[
60
  datasets.SplitGenerator(
61
  name=datasets.Split.TRAIN,
@@ -70,6 +72,7 @@ class NSynth(datasets.GeneratorBasedBuilder):
70
  gen_kwargs={"filepath": dl_paths['test']}
71
  ),
72
  ]
 
73
  def _generate_examples(self, filepath):
74
  dir_list = os.listdir(filepath)
75
  folder_path = os.path.join(filepath, dir_list[0])
@@ -96,5 +99,5 @@ class NSynth(datasets.GeneratorBasedBuilder):
96
  "instrument_family_str": examples[key]["instrument_family_str"],
97
  "instrument_source": examples[key]["instrument_source"],
98
  "instrument_source_str": examples[key]["instrument_source_str"],
99
- "audio": {'path': audio_filename, 'bytes': wavfile.read(audio_filename)[1]}
100
  }
 
19
  This dataset was created as an attempt to establish a high-quality entry point into audio machine learning, in response to the surge of breakthroughs in generative modeling of images due to the abundance of approachable image datasets (MNIST, CIFAR, ImageNet). NSynth is meant to be both a benchmark for audio ML and a foundation to be expanded on with future datasets.
20
  """
21
 
22
+ _HOMEPAGE = "https://magenta.tensorflow.org/datasets/nsynth"
23
 
24
  _LICENSE = "Creative Commons Attribution 4.0 International (CC BY 4.0)"
25
 
 
43
  "instrument_source_str": datasets.Value("string"),
44
  "audio": datasets.features.Audio()
45
  })
46
+
47
  return datasets.DatasetInfo(
48
  description=_DESCRIPTION,
49
  features=features,
 
51
  license=_LICENSE,
52
  citation=_CITATION,
53
  )
54
+
55
  def _split_generators(self, dl_manager):
56
  dl_paths = dl_manager.download_and_extract({
57
  'train': 'http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-train.jsonwav.tar.gz',
58
  'validation': 'http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-valid.jsonwav.tar.gz',
59
  'test': 'http://download.magenta.tensorflow.org/datasets/nsynth/nsynth-test.jsonwav.tar.gz',
60
+ })
61
  return[
62
  datasets.SplitGenerator(
63
  name=datasets.Split.TRAIN,
 
72
  gen_kwargs={"filepath": dl_paths['test']}
73
  ),
74
  ]
75
+
76
  def _generate_examples(self, filepath):
77
  dir_list = os.listdir(filepath)
78
  folder_path = os.path.join(filepath, dir_list[0])
 
99
  "instrument_family_str": examples[key]["instrument_family_str"],
100
  "instrument_source": examples[key]["instrument_source"],
101
  "instrument_source_str": examples[key]["instrument_source_str"],
102
+ "audio": {'path': audio_filename, 'bytes': wavfile.read(audio_filename)[1]},
103
  }
README.md CHANGED
@@ -1,3 +1,47 @@
1
  ---
2
  license: cc-by-4.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
1
  ---
2
  license: cc-by-4.0
3
+ dataset_info:
4
+ features:
5
+ - name: id
6
+ dtype: string
7
+ - name: note
8
+ dtype: int64
9
+ - name: note_str
10
+ dtype: string
11
+ - name: instrument
12
+ dtype: int64
13
+ - name: instrument_str
14
+ dtype: string
15
+ - name: pitch
16
+ dtype: int64
17
+ - name: velocity
18
+ dtype: int64
19
+ - name: sample_rate
20
+ dtype: int64
21
+ - name: qualities
22
+ sequence: int64
23
+ - name: qualities_str
24
+ sequence: string
25
+ - name: instrument_family
26
+ dtype: int64
27
+ - name: instrument_family_str
28
+ dtype: string
29
+ - name: instrument_source
30
+ dtype: int64
31
+ - name: instrument_source_str
32
+ dtype: string
33
+ - name: audio
34
+ dtype: audio
35
+ splits:
36
+ - name: train
37
+ num_bytes: 129511245
38
+ num_examples: 289205
39
+ - name: validation
40
+ num_bytes: 5679042
41
+ num_examples: 12678
42
+ - name: test
43
+ num_bytes: 1830670
44
+ num_examples: 4096
45
+ download_size: 25233566634
46
+ dataset_size: 137020957
47
  ---