espnet2.train.iterable_dataset.load_kaldi
Less than 1 minute
espnet2.train.iterable_dataset.load_kaldi
espnet2.train.iterable_dataset.load_kaldi(input)
Load Kaldi formatted data from the specified input.
This function loads matrices from Kaldi files (e.g., .ark or .scp) using the kaldiio library. It handles both single and multi-channel wave files and returns the data as a NumPy array.
- Parameters:input (str) – The path to the Kaldi file to load.
- Returns: The loaded data as a NumPy array. The shape of the array will depend on the format of the data in the Kaldi file. It can be either (NSample, Channel) for multichannel audio or (Nsample,) for single-channel audio.
- Return type: np.ndarray
- Raises:RuntimeError – If the input format is unexpected or if the loading fails.
Examples
>>> array = load_kaldi('path/to/file.ark')
>>> print(array.shape)
(N, C) # where N is the number of samples and C is the number of channels.