vdivyasharma commited on
Commit
85bd063
·
verified ·
1 Parent(s): 3a8e220

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +23 -1
README.md CHANGED
@@ -257,9 +257,31 @@ For more details, please see the Table 1 and Section 3 of our paper: https://acl
257
 
258
  You can load a specific language using:
259
  ```python
 
 
 
260
  from datasets import load_dataset
261
 
262
- ds = load_dataset("vdivyasharma/IndicSynth", name="Hindi", split="train")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
263
  ```
264
  ## License
265
  IndicSynth is released under the **CC BY-NC 4.0 License**.
 
257
 
258
  You can load a specific language using:
259
  ```python
260
+
261
+ import os
262
+ import soundfile as sf
263
  from datasets import load_dataset
264
 
265
+ language = "Hindi" # Specify the target language here
266
+
267
+ # Load Dataset
268
+ dataset = load_dataset("vdivyasharma/IndicSynth", name=language, split="train")
269
+
270
+ # Output directory
271
+ output_dir = language
272
+ os.makedirs(output_dir, exist_ok=True)
273
+
274
+ # Loop through dataset and save each clip
275
+ for example in dataset:
276
+ audio_array = example["audio"]["array"]
277
+ sampling_rate = example["audio"]["sampling_rate"]
278
+
279
+ # Extract original filename
280
+ original_name = example.get("file") or example.get("path") or example["audio"]["path"].split("/")[-1]
281
+
282
+ # Save to disk
283
+ sf.write(os.path.join(output_dir, original_name), audio_array, sampling_rate)
284
+
285
  ```
286
  ## License
287
  IndicSynth is released under the **CC BY-NC 4.0 License**.