ldc_bpcsad.io.write_textgrid_file

ldc_bpcsad.io.write_textgrid_file(fpath, segs, tier='sad', rec_dur=None, is_sorted=False, precision=2)[source]

Write speech segments to Praat TextGrid file.

Parameters:
  • fpath (pathlib.Path) – Path to output TextGrid file.

  • segs (Iterable[Segment]) – Speech segments.

  • tier (str, optional) – Name of IntervalTier to write segments to. (Default: ‘sad’)

  • 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)

  • precision (int, optional) – Output will be truncated to precision decimal places. (Default: 2)

Notes

https://www.fon.hum.uva.nl/praat/manual/TextGrid_file_formats.html