Saving Outputting and Saving as a TextGrid

Outputting TextGrids

Each aligned_textgrid object has a .return_*() method that returns its corresponding praatio object.

  • sequence_interval.return_interval() returns a praatio interval
  • sequence_interval.return_tier() returns a praatio interval tier
  • aligned_textgrid.return_textgrid() returns a praatio TextGrid

Here’s an example.

from aligned_textgrid import AlignedTextGrid, Word, Phone

tg = AlignedTextGrid(
    textgrid_path="../resources/josef-fruehwald_speaker.TextGrid",
    entry_classes=[Word, Phone]
)

Returning an interval

tg[0].Phone.first.return_interval()
Interval(start=0.0, end=0.11, label='')

Returning a tier

tg[0].Phone.return_tier()
<praatio.data_classes.interval_tier.IntervalTier at 0x123077dc0>

Returning a TextGrid

tg.return_textgrid()
<praatio.data_classes.textgrid.Textgrid at 0x1230776d0>

Saving a TextGrid

You can save an aligned textgrid to a .TextGrid file with the .save_textgrid() method.

tg.save_textgrid(
    save_path="new.TextGrid"
)

Reuse

GPLv3