Module: textgrid_modifiers

This module contains the methods that take one or more tiers or textgrids and returns a modified result.

Since:
  • March 25, 2015
Author:
  • Tim Mahrt
Source:

Methods

(inner) appendTextgrid(tg1, tg2, onlyMatchingNamesopt) → {Textgrid}

Append one textgrid to the end of this one
Parameters:
Name Type Attributes Default Description
tg1 Textgrid the source textgrid
tg2 Textgrid the textgrid to add on
onlyMatchingNames boolean <optional>
true only include tiers that appear in both textgrids
Source:
Returns:
Type
Textgrid

(inner) appendTier(tier1, tier2) → {TextgridTier}

Add one tier to the end of another
Parameters:
Name Type Description
tier1 TextgridTier the base tier
tier2 TextgridTier the tier to add
Source:
Returns:
Type
TextgridTier

(inner) cropIntervalTier(cropStart, cropEnd, number, rebaseToZero) → {Textgrid}

Creates a new tier with only the entries from the crop region
Parameters:
Name Type Description
cropStart number
cropEnd number
number string one of 'strict', 'lax', or 'truncated' If 'strict', only intervals wholly contained by the crop interval will be kept. If 'lax', partially contained intervals will be kept. If 'truncated', partially contained intervals will be truncated to fit within the crop region.
rebaseToZero boolean if true the cropped textgrid values will be subtracted by cropStart
Source:
Returns:
A copy of this tier with only entries from the crop region
Type
Textgrid

(inner) cropPointTier(pointTier, cropStart, cropEnd, mode, rebaseToZero) → {PointTier}

Creates a new tier containing only entries from inside the crop interval
Parameters:
Name Type Description
pointTier PointTier
cropStart number
cropEnd number
mode string mode is ignored. This parameter is kept for compatibility with IntervalTier.crop()
rebaseToZero boolean if true, all times will be subtracted by cropStart
Source:
Returns:
Returns a copy of this tier with only values from the crop region.
Type
PointTier

(inner) cropTextgrid(tg, cropStart, cropEnd, mode, rebaseToZero) → {Textgrid}

Creates a textgrid that only contains intervals from the crop region
Parameters:
Name Type Description
tg Textgrid
cropStart number
cropEnd number
mode string one of 'strict', 'lax', or 'truncated' If 'strict', only intervals wholly contained by the crop interval will be kept. If 'lax', partially contained intervals will be kept. If 'truncated', partially contained intervals will be truncated to fit within the crop region.
rebaseToZero boolean if true, the all times in entries will be subtracted by the cropStart
Source:
Returns:
A new textgrid containing only entries that appear in the crop region.
Type
Textgrid

(inner) cropTier(tier, cropStart, cropEnd, mode, rebaseToZero) → {TextgridTier}

Creates a new tier containing only entries from inside the crop interval
Parameters:
Name Type Description
tier TextgridTier
cropStart number
cropEnd number
mode string mode is ignored. This parameter is kept for compatibility with IntervalTier.crop()
rebaseToZero boolean if true, all times will be subtracted by cropStart
Source:
Returns:
Returns a copy of this tier with only values from the crop region.
Type
TextgridTier

(inner) editTextgridTimestamps(tg, offset, allowOvershootopt) → {Textgrid}

Modifies all timestamps in the Textgrid and in the contained tiers by a constant amount
Parameters:
Name Type Attributes Default Description
tg Textgrid
offset number the amount to modify all timestamps by
allowOvershoot boolean <optional>
false if false and offset pushes a value past maxTimestamp, throw an error; otherwise, lengthen the textgrid
Source:
Returns:
Type
Textgrid

(inner) editTierTimestamps(tier, offset, allowOvershootopt) → {TextgridTier}

Modifies all timestamps by a constant amount
Parameters:
Name Type Attributes Default Description
tier TextgridTier
offset number
allowOvershoot boolean <optional>
false if false and offset pushes a value past maxTimestamp, throw an error; otherwise, lengthen the tier
Source:
Returns:
Type
TextgridTier

(inner) eraseRegionFromTextgrid(tg, start, stop, doShrink) → {TextgridTier}

Makes a region in all tiers blank (removes all contained entries)
Parameters:
Name Type Description
tg TextgridTier
start number
stop number
doShrink boolean if true, all values after the erase region will be shifted earlier in time by (stop - start) seconds
Source:
Returns:
A copy of this textgrid without entries in the specified region.
Type
TextgridTier

(inner) eraseRegionFromTier(tier, start, stop, doShrink) → {TextgridTier}

Makes a region in a tier blank (removes all contained entries)
Parameters:
Name Type Description
tier TextgridTier
start number
stop number
doShrink boolean if true, all values after the erase region will be shifted earlier in time by (stop - start) seconds
Source:
Returns:
A copy of this tier without entries in the specified region.
Type
TextgridTier

(inner) insertSpaceIntoTextgrid(tg, start, duration, collisionCode) → {Textgrid}

Inserts a blank region into a textgrid
Parameters:
Name Type Description
tg Textgrid
start number
duration number Note: every item that occurs after /start/ will be pushed back by /duration/ seconds.
collisionCode boolean if /start/ occurs inside a labeled interval, this determines the behaviour. Must be one of 'stretch', 'split', or 'no change' 'stretch' - stretches the interval by /duration/ amount 'split' - splits the interval into two--everything to the right of 'start' will be advanced by 'duration' seconds 'no change' - leaves the interval as is with no change
Source:
Returns:
A copy of this textgrid with the inserted blank region.
Type
Textgrid

(inner) insertSpaceIntoTier(tier, start, duration, collisionCode) → {TextgridTier}

Inserts a blank region into a tier
Parameters:
Name Type Description
tier TextgridTier
start number
duration number Note: every item that occurs after /start/ will be pushed back by /duration/ seconds.
collisionCode boolean (unused parameter for point tiers) if /start/ occurs inside a labeled interval, this determines the behaviour. Must be one of 'stretch', 'split', or 'no change' 'stretch' - stretches the interval by /duration/ amount 'split' - splits the interval into two--everything to the right of 'start' will be advanced by 'duration' seconds 'no change' - leaves the interval as is with no change
Source:
Returns:
A copy of this tier with the inserted blank region.
Type
TextgridTier

(inner) mergeTextgridTiers(tg, tierNameListopt, preserveOtherTiersopt, intervalTierNameopt, pointTierNameopt) → {Textgrid}

Combine tiers in a textgrid.
Parameters:
Name Type Attributes Default Description
tg Textgrid
tierNameList Array <optional>
null The list of tier names to include in the merge. If null, all tiers are merged.
preserveOtherTiers boolean <optional>
true If true, keep tiers that were not merged. If false, the return textgrid will only have one merged tier for all interval tiers and one merged tier for all point tiers, if present.
intervalTierName string <optional>
'merged intervals'
pointTierName string <optional>
'merged points'
Source:
Returns:
A copy of the textgrid with the specified tiers merged.
Type
Textgrid

(inner) takeIntervalTierDifference() → {TextgridTier}

Takes the set difference of this tier and the given one. Any overlapping portions of entries with entries in this textgrid will be removed from the returned tier.
Source:
Returns:
Type
TextgridTier

(inner) takeIntervalTierIntersection() → {TextgridTier}

Takes the set intersection of this tier and the given one. Only intervals that exist in both tiers will remain in the returned tier. If intervals partially overlap, only the overlapping portion will be returned.
Source:
Returns:
Type
TextgridTier

(inner) takeTierUnion() → {TextgridTier}

Takes the set union of two tiers. All the entries in the second tier will be added to the first. Overlapping entries will be merged together.
Source:
Returns:
Type
TextgridTier