|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"""DAPS Dataset""" |
|
|
|
|
|
import glob |
|
|
import os |
|
|
|
|
|
import datasets |
|
|
|
|
|
|
|
|
_CITATION = """\ |
|
|
@article{mysore2014can, |
|
|
title={Can we automatically transform speech recorded on common consumer devices in real-world environments into professional production quality speech?—a dataset, insights, and challenges}, |
|
|
author={Mysore, Gautham J}, |
|
|
journal={IEEE Signal Processing Letters}, |
|
|
volume={22}, |
|
|
number={8}, |
|
|
pages={1006--1010}, |
|
|
year={2014}, |
|
|
publisher={IEEE} |
|
|
} |
|
|
""" |
|
|
|
|
|
|
|
|
_DESCRIPTION = """\ |
|
|
The DAPS (Device and Produced Speech) dataset is a collection of aligned versions of professionally produced studio speech recordings and recordings of the same speech on common consumer devices (tablet and smartphone) in real-world environments. It has 15 versions of audio (3 professional versions and 12 consumer device/real-world environment combinations). Each version consists of about 4 1/2 hours of data (about 14 minutes from each of 20 speakers). |
|
|
""" |
|
|
|
|
|
_HOMEPAGE = "https://ccrma.stanford.edu/~gautham/Site/daps.html" |
|
|
|
|
|
_LICENSE = "Creative Commons Attribution Non Commercial 4.0 International" |
|
|
|
|
|
|
|
|
|
|
|
_URLS = "https://zenodo.org/record/4660670/files/daps.tar.gz" |
|
|
|
|
|
|
|
|
class DapsDataset(datasets.GeneratorBasedBuilder): |
|
|
"""The DAPS (Device and Produced Speech) dataset is a collection of aligned versions of professionally produced studio speech recordings and recordings of the same speech on common consumer devices (tablet and smartphone) in real-world environments.""" |
|
|
|
|
|
VERSION = datasets.Version("2.12.0") |
|
|
|
|
|
DEFAULT_CONFIG_NAME = "aligned_examples" |
|
|
|
|
|
def _info(self): |
|
|
features = datasets.Features( |
|
|
{ |
|
|
"recording_environment": datasets.Value("string"), |
|
|
"speaker_id": datasets.Value("string"), |
|
|
"script_id": datasets.Value("string"), |
|
|
"clean_path": datasets.Value("string"), |
|
|
"produced_path": datasets.Value("string"), |
|
|
"device_path": datasets.Value("string"), |
|
|
"clean_audio": datasets.Audio(sampling_rate=44_100), |
|
|
"produced_audio": datasets.Audio(sampling_rate=44_100), |
|
|
"device_audio": datasets.Audio(sampling_rate=44_100), |
|
|
} |
|
|
) |
|
|
return datasets.DatasetInfo( |
|
|
|
|
|
description=_DESCRIPTION, |
|
|
|
|
|
features=features, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
homepage=_HOMEPAGE, |
|
|
|
|
|
license=_LICENSE, |
|
|
|
|
|
citation=_CITATION, |
|
|
) |
|
|
|
|
|
def _split_generators(self, dl_manager): |
|
|
"""Returns SplitGenerators.""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
urls = _URLS |
|
|
data_dir = dl_manager.download_and_extract(urls) |
|
|
return [ |
|
|
datasets.SplitGenerator( |
|
|
name=datasets.Split.TRAIN, |
|
|
|
|
|
gen_kwargs={ |
|
|
"filepath": data_dir, |
|
|
}, |
|
|
) |
|
|
] |
|
|
|
|
|
|
|
|
def _generate_examples(self, filepath): |
|
|
gt = ["clean", "produced"] |
|
|
environments = [ |
|
|
"ipad_balcony1", |
|
|
"ipad_livingroom1", |
|
|
"ipadflat_office1", |
|
|
"ipad_bedroom1", |
|
|
"ipad_office1", |
|
|
"iphone_balcony1", |
|
|
"ipad_confroom1", |
|
|
"ipad_office2", |
|
|
"iphone_bedroom1", |
|
|
"ipad_confroom2", |
|
|
"ipadflat_confroom1", |
|
|
"iphone_livingroom1", |
|
|
] |
|
|
|
|
|
for env in environments: |
|
|
for device_path in glob.glob(os.path.join(filepath, env) + "/*.wav"): |
|
|
speaker_id = os.path.basename(device_path).split("_")[-4] |
|
|
script_id = os.path.basename(device_path).split("_")[-3] |
|
|
clean_path = device_path.replace(env, "clean") |
|
|
produced_path = device_path.replace(env, "produced") |
|
|
with open(clean_path, "rb") as f: |
|
|
clean_audio = {"path": clean_path, "bytes": f.read()} |
|
|
with open(produced_path, "rb") as f: |
|
|
produced_audio = {"path": produced_path, "bytes": f.read()} |
|
|
with open(device_path, "rb") as f: |
|
|
device_audio = {"path": device_path, "bytes": f.read()} |
|
|
yield f"{speaker_id}_{script_id}_{env}", { |
|
|
"recording_environment": env, |
|
|
"speaker_id": speaker_id, |
|
|
"script_id": script_id, |
|
|
"clean_path": clean_path, |
|
|
"produced_path": produced_path, |
|
|
"device_path": device_path, |
|
|
"clean_audio": clean_audio, |
|
|
"produced_audio": produced_audio, |
|
|
"device_audio": device_audio, |
|
|
} |
|
|
|