ldc_bpcsad.io
.write_htk_label_file
- ldc_bpcsad.io.write_htk_label_file(fpath, segs, rec_dur=None, is_sorted=False, in_sec=True, precision=2)[source]
Write speech segments to HTK label file.
The resulting file will contain alternating speech/non-speech segments.
- Parameters:
fpath (pathlib.Path) – Path to file in HTK label file format.
segs (Iterable[Segment]) – Speech segments.
rec_dur (float, optional) – Recording duration in seconds. Used to set boundary of final non-speech segment. If None, set to
segs[-1].offset
. (Default: None)is_sorted (bool, optional) – If True, treat segs as already sorted. Otherwise, sort before writing. (Default: False)
in_sec (bool, optional) – If True, write onsets/offsets in seconds. Else, write onsets/offsets in HTK 100 ns units. (Default: True)
precision (int, optional) – Output will be truncated to precision decimal places. (Default: 2)
References