Skip to content

Conversation

@lenzo-ka
Copy link
Contributor

Description

Add pocketsphinx_to_textgrid utility to convert PocketSphinx JSON alignment output to Praat TextGrid format.

Closes #455

Features

  • Converts alignment JSON from pocketsphinx align to TextGrid format
  • Supports all alignment levels: words, phones, and states (depending on -phone_align / -state_align options used)
  • Outputs to stdout by default, or to a file with -o
  • Optional Praat integration: -w audio.wav --praat opens the result in Praat

Usage

# Basic conversion to stdout
pocketsphinx align audio.wav "hello world" | pocketsphinx_to_textgrid

# Write to file
pocketsphinx -phone_align yes align audio.wav "hello" | pocketsphinx_to_textgrid -o output.TextGrid

# Open in Praat with audio
pocketsphinx -state_align yes align audio.wav "hello" | pocketsphinx_to_textgrid -o out.TextGrid -w audio.wav --praat

Verification steps

  1. Build and install the package
  2. Run alignment and pipe to the utility:
    pocketsphinx -phone_align yes align test/data/goforward.raw "go forward ten meters" | pocketsphinx_to_textgrid
  3. Verify TextGrid output has words and phones tiers
  4. Optionally open in Praat to verify alignment visually

Convert PocketSphinx JSON alignment output to Praat TextGrid format.
Supports word, phone, and state tiers depending on alignment level.
Optional Praat integration with -w and --praat flags.
@lenzo-ka lenzo-ka requested a review from dhdaines January 14, 2026 15:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Output to TextGrid

1 participant