Skip to content

codakkk/flutter_textgrid

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

From Praat's documentation, a TextGrid object consists of a number of tiers. There are two kinds of tiers: an interval tier is a connected sequence of labelled intervals, with boundaries in between. A point tier is a sequence of labelled points.

Index

Features

  • Read and write TextGrid files
  • Supports both Long & Short TextGrid formats
  • Manipulate TextGrid objects

How to use

Install

To use [flutter_textgrid], install [flutter_textgrid] by adding it to your pubspec.yaml file:"

For a Flutter project:

flutter pub add flutter_textgrid

For a Dart project:

dart pub add flutter_textgrid

Create and edit TextGrid

final textGrid = TextGrid(
    startTime: Time.zero,
    endTime: Time(5), // 5 seconds
);

final intervalTier = IntervalTier(name: 'test');
final ia = IntervalAnnotation(
    startTime: Time.zero,
    endTime: const Time(0.5),
    text: 'worda',
);
intervalTier.addAnnotation(ia);

textGrid.addTier(intervalTier);

Read TextGrid

First of all create a TextGridSerializer. It can read both Long and Short format, without any configurations.

From String

final tgs = TextGridSerializer();

final tgContent = "...TextGrid...";

final textGrid = tgs.fromString(tgContent);

From file

final tgs = TextGridSerializer();

final textGrid = tgs.fromFile(File('../path/to/file'));

// Just use your TextGrid file

or you can read directly from a path:

final tgs = TextGridSerializer();

final textGrid = tgs.fromPath('../path/to/file');

// Just use your TextGrid file

or you can use the [fromString] method.

final tgs = TextGridSerializer();

final fileContent = File('../path/to/file').readAsStringSync();

final textGrid = tgs.fromString(fileContent);

// Just use your TextGrid file

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages