Lhotse is a Python library for data preparation in speech and audio processing. It provides a flexible, declarative API for representing audio collections as manifests (e.g., Recordings, Supervisions, Cuts) and tools for data manipulation, augmentation, and feature extraction. It's currently at version 1.32.2 and maintains an active development and release cadence.
pip install lhotseVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to create a basic `MonoCut` representing an audio segment's metadata and encapsulate it within a `CutSet`. It shows how to access basic properties like ID and duration. Lhotse operates primarily on `CutSet` objects, which are collections of `Cut`s (e.g., `MonoCut`, `MixedCut`).
Review code that directly compares or performs arithmetic with time-related attributes (e.g., `cut.duration`, `cut.start`). In most cases, implicit conversion works, but explicit conversion to `float` (e.g., `float(cut.duration)`) might be needed for strict comparisons or external libraries expecting floats.
Leverage Lhotse's dataset and data loader utilities (e.g., `lhotse.dataset.K2SpeechRecognitionDataset`, `torch.utils.data.DataLoader`) which handle batching and resource management efficiently. Avoid `list()` on large `CutSet`s after transformations unless absolutely necessary, and prefer iterator-based processing.
Install Lhotse with the necessary optional dependencies using the extra syntax, e.g., `pip install lhotse[kaldi,torchaudio,train]` for a common set, or `pip install lhotse[all]` for most extras. Refer to the official documentation for a complete list of extras.
When manually loading features, use `lhotse.features.io.read_lilcom_array` or `lilcom.decompress` to uncompress the data. When using Lhotse's datasets, features are typically decompressed automatically as part of the data loading pipeline.
No dependency data recorded yet.