| """ |
| Example usage for the Designed Vocalizations Dataset. |
| |
| pip install "datasets<4" |
| python example.py |
| |
| Two configs — `raw` (source recordings) and `designed` (effect-processed clips) — |
| each with a `train` and `test` split. |
| |
| TRAIN non-parallel: the raw and designed train pools are not aligned. |
| TEST parallel: evaluate the (source -> reference) pairs listed in |
| metadata/test_pairs.csv, each with a seen/unseen condition. |
| """ |
| import csv |
| from itertools import islice |
| from datasets import load_dataset |
| from huggingface_hub import hf_hub_download |
|
|
| REPO = "NCSOFT/Designed-Vocalizations-Dataset" |
|
|
| |
| |
| raw_train = load_dataset(REPO, "raw", split="train") |
| print(f"train: {len(raw_train)} raw sources") |
|
|
| |
| designed_train = load_dataset(REPO, "designed", split="train", streaming=True) |
| clip = next(iter(designed_train)) |
| wav, sr = clip["audio"]["array"], clip["audio"]["sampling_rate"] |
| print(f" designed (streamed): {clip['file_path']} | preset {clip['preset']}") |
|
|
| |
| |
| |
| sources = load_dataset(REPO, "raw", split="test", streaming=True) |
| references = load_dataset(REPO, "designed", split="test", streaming=True) |
|
|
| |
| source_by_path = {clip["file_path"]: clip for clip in sources} |
|
|
| |
| pairs_csv = hf_hub_download(REPO, "metadata/test_pairs.csv", repo_type="dataset") |
| seen_split = {row["reference"]: row["seen_split"] |
| for row in csv.DictReader(open(pairs_csv, encoding="utf-8"))} |
|
|
| for reference in islice(references, 3): |
| source = source_by_path[reference["source"]] |
| src_wav = source["audio"]["array"] |
| ref_wav = reference["audio"]["array"] |
| print(f" [{seen_split[reference['file_path']]}] " |
| f"{reference['source']} -> {reference['file_path']}") |
| |
|
|