This module contains code for converting to and from the Textgrid
datastructure. Textgrid files are typically stored as plain text.
This library does not do actual file IO but instead converts
to and from loaded strings to instances of Textgrid.
- Since:
- March 25, 2015
- Source:
Methods
(inner) parseTextgrid(text, readRaw) → {Textgrid}
Creates an instance of a Textgrid from the contents of a .Textgrid file.
Parameters:
Name | Type | Default | Description |
---|---|---|---|
text |
Buffer | string | can be either a buffer or a raw text string | |
readRaw |
boolean | false | default false; if true, points and intervals with an empty label '' are removed |
- Source:
Returns:
- Type
- Textgrid
(inner) prepTgForSaving(tg, minimumIntervalLengthopt, minTimestampopt, maxTimestampopt)
Processing done before every textgrid is saved (serializeTextgrid calls this function) -- gaps are filled with silence and short intervals can be removed
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tg |
Textgrid | |||
minimumIntervalLength |
number |
<optional> |
MIN_INTERVAL_LENGTH | remove all intervals shorter than this; if null, don't remove any intervals |
minTimestamp |
number |
<optional> |
null | - the minTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If minTimestamp is larger than timestamps in your textgrid, an exception will be thrown. |
maxTimestamp |
number |
<optional> |
null | - the maxTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If maxTimestamp is larger than timestamps in your textgrid, an exception will be thrown. |
- Source:
Returns:
A cleaned TextGrid
(inner) serializeTextgrid(tg, minimumIntervalLengthopt, minTimestampopt, maxTimestampopt, useShortFormopt)
Formats a textgrid instance for saving to a .TextGrid file.
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tg |
Textgrid | |||
minimumIntervalLength |
number |
<optional> |
MIN_INTERVAL_LENGTH | remove all intervals shorter than this; if null, don't remove any intervals |
minTimestamp |
number |
<optional> |
null | - the minTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If minTimestamp is larger than timestamps in your textgrid, an exception will be thrown. |
maxTimestamp |
number |
<optional> |
null | - the maxTimestamp of the saved Textgrid; if None, use whatever is defined in the Textgrid object. If maxTimestamp is larger than timestamps in your textgrid, an exception will be thrown. |
useShortForm |
boolean |
<optional> |
true | - specifies whether to use the short or long form specification of a textgrid; the long form is more human readable, the short form is more compact |
- Source:
Returns:
A text representation of a textgrid that can be opened by Praat
(inner) serializeTextgridToCsv(tg, pivotTierName, tierNameListopt) → {text}
Formats a textgrid instance for saving to a .csv file
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
tg |
Textgrid | |||
pivotTierName |
string | One row in the output is listed for each entry in this tier. The corresponding entry in each tier will be provided on the same row along with the start and end time of the entry from the pivot tier. | ||
tierNameList |
Array |
<optional> |
null | the list of tier names to save. If null, save all tiers. |
- Source:
Returns:
- Type
- text