Skip to main content

Library to parse speech datasets stored in a generic format based on TextGrids. A tool (CLI) for converting common datasets like LJ Speech into a generic format is included.

Project description

speech-dataset-parser

PyPI PyPI MIT MIT MIT MIT

Library to parse speech datasets stored in a generic format based on TextGrids. A tool (CLI) for converting common datasets like LJ Speech into a generic format is included. Speech datasets consists of pairs of .TextGrid and .wav files. The TextGrids need to contain a tier which has each symbol separated in an interval, e.g., T|h|i|s| |i|s| |a| |t|e|x|t|.

Generic Format

The format is as follows: {Dataset name}/{Speaker name};{Speaker gender};{Speaker language}[;{Speaker accent}]/[Subfolder(s)]/{Recordings as .wav- and .TextGrid-pairs}

Example: LJ Speech/Linda Johnson;2;eng;North American/wavs/...

Speaker names can be any string (excluding ; symbols). Genders are defined via their ISO/IEC 5218 Code. Languages are defined via their ISO 639-2 Code. Accents are optional and can be any string (excluding ; symbols).

Installation

pip install speech-dataset-parser --user

Library Usage

from speech_dataset_parser import parse_dataset

entries = list(parse_dataset(folder..., grid-tier-name...))

The resulting entries list contains dataclass instances with these properties:

  • symbols: Tuple[str, ...]
  • intervals: Tuple[float, ...]
  • symbols_language: str
  • speaker_name: str
  • speaker_accent: str
  • speaker_gender: int
  • audio_file_abs: Path
  • min_time: float
  • max_time: float

CLI Usage

dataset-converter-cli [-h] [-v] {convert-ljs} ...

CLI Features

  • convert-ljs: convert LJ Speech dataset to a generic dataset

CLI Example

# Convert LJ Speech dataset with symbolic links to the audio files
dataset-converter-cli convert-ljs \
  "/data/datasets/LJSpeech-1.1" \
  "/tmp/ljs" \
  --tier "Symbols" \
  --symlink

Dependencies

  • tqdm
  • TextGrid>=1.5
  • ordered_set>=4.1.0

Roadmap

  • Supporting conversion of more datasets
  • Adding tests

License

MIT License

Acknowledgments

Funded by the Deutsche Forschungsgemeinschaft (DFG, German Research Foundation) – Project-ID 416228727 – CRC 1410

Citation

If you want to cite this repo, you can use this BibTeX-entry:

@misc{tssdp22,
  author = {Taubert, Stefan},
  title = {speech-dataset-parser},
  year = {2022},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/stefantaubert/speech-dataset-parser}}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

speech-dataset-parser-0.0.1.tar.gz (14.2 kB view hashes)

Uploaded Source

Built Distribution

speech_dataset_parser-0.0.1-py3-none-any.whl (14.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page