@nianyi-wang/textgrid
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

textgrid-js

This is a NodeJS package for manipulating Praat textgrid files. It is written in the ES Module style.

Installation

$ npm i @nianyi-wang/textgrid

Usage

The following code snippet shows how to iterate through certain tier in a Textgrid file and change their labels.

import { TextGrid, IntervalTier } from '@nianyi-wang/textgrid';
import * as Fs from 'fs';

// Input
const src = './input.Textgrid';
const tg = TextGrid.FromString(fs.readFileSync(src).toString());

// TextGrid manipulations
const tier = tg.tiers.get('phonemes');
function ProcessLabel(label) {
	// TODO
	return label;
}
for(const range of tier)
	tier.label = ProcessLabel(tier.label);

// Output
fs.writeFileSync(src, tg.Serialize());

Package Sidebar

Install

npm i @nianyi-wang/textgrid

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

76.9 kB

Total Files

24

Last publish

Collaborators

  • nianyi-wang