lnaba.reisen

WebPraat

Last edited by D, 2026-11-09 ; finished

Back to Projects

webpraat.lnaba.reisen

Project source

github.com/gggentooo/webpraat

Screenshot of WebPraat on Safari

About this project

As some might know, I’m currently majoring Linguistics and Cognitive Science at HUFS. In our phonetics classes, we use a program called Praat; it’s a tool that makes a lot of useful phonetic analysis easy. However, one caveat is that its GUI is a bit outdated and not-straightforward for first-time users. There’s also no Korean support for its menu labels. So, I thought it’d be a fun side project that might help some of my colleagues as well as myself.

AI assistance (Antigravity with Gemini 3.8 & Claude Opus 5.5) was used in the planning & implementation phases of this project.

This article is written by yours truly; segments with excerpts from AI-generated documents will be marked as such. I will outline Praat’s and WebPraat’s architecture briefly, then move on to the agentic coding strategies I used for development. If you want to learn more about WebPraat’s technical structure, feel free to visit its source repository at github.com/gggentooo/webpraat.

Praat’s structure & porting strategy

Source code for the original Praat Praat can be roughly split into two parts: the core computation engine, and the GUI layer. Both are mainly written in C++17. A minor problem, C++ code can’t be directly executed on a web browser. JavaScript can. Luckily, this is a problem encountered multiple times by multiple developers across history, and an extremely useful tool called WebAssembly exists out there that compiles C++ code (and many others) into a JS library.

We are then faced with two options for porting C++ programs into a web browser compatible application: A) Use WASM to directly compile the original into JS, or B) Rewrite the program in native JS from scratch. I chose option A for the core engine and B for the GUI wrapper.

Since the core engine is comprised of multiple submodules with several dependencies, creating a brief technical document for it seemed like a good idea. I asked Gemini to review the original codebase and generate praat_architecture.md. I will not include the entirety of its content in this article as it is quite lengthy, though the high-level overview chart and module dependency graph are small enough to append here:

High-level overview chart

┌────────────────────────────────────────────────────────┐
│  main/            entry point, logo, plugin dispatch   │
├────────────────────────────────────────────────────────┤
│  artsynth  EEG  FFNet  sensors                         │  Domain modules
│  gram  LPC  dwtools  stat                              │  (optional layers)
│  foned                                                 │  Interactive editors
│  fon                                                   │  Phonetic objects & DSP
├────────────────────────────────────────────────────────┤
│  sys                                                   │  Framework (object model,
│  dwsys  kar                                            │  GUI, scripting, graphics)
├────────────────────────────────────────────────────────┤
│  melder                                                │  Foundation (memory,
│                                                        │  strings, audio, I/O)
├────────────────────────────────────────────────────────┤
│  external/  (portaudio, espeak, FLAC, LAME, GSL, …)    │  Vendored third-party libs
└────────────────────────────────────────────────────────┘

Module dependency graph

main
 ├── fon, foned, artsynth, EEG, FFNet, sensors, gram, LPC, dwtools, stat
 └── sys

artsynth → fon
EEG → fon, foned
FFNet → dwsys, stat
sensors → fon
gram → sys, fon
LPC → fon, dwsys
dwtools → fon, dwsys, stat
stat → sys

foned → fon, sys
fon → sys, dwsys, kar, espeak, flac, gsl, whispercpp

sys → melder, kar
dwsys → melder, gsl
kar → melder

melder → portaudio, zlib, blake3

After having read this technical document, I verified its contents against the source code and moved on to coming up with a development plan for WebPraat.

Development phases

Going into any programming project headfirst without a concrete plan is always a bad idea. Gemini produced the development plan document, as well as WebPraat’s architecture document. I reviewed it, then generated an agents.md containing the implementation guide split into multiple phases.

Initially there were seven phases total; It took about 2 hours for me and Gemini to go through all 7 steps, plus a configurable i18n system. The initial implementation surprisingly built without much issue; I, however, tested its features and found some problems.

Phase 8: TextGrid annotation

The initial implementation of the TextGrid window lacked the top menu bar, which is necessary in Praat for creating new annotation intervals. Praat’s original user-end workflow for editing TextGrid intervals is not very intuitive in the first place; this seemed like a good opportunity for a complete overhaul into a simpler interval boundary manipulation mechanism where the user clicks directly on the sound file’s view window to create a new boundary, like in a video editor. Nonetheless, I wanted to stay as faithful as possible to the original Praat and decided to add the click-based mechanism on top of the menu-based approach that the original program took.

An extra phase was added to the development plan, and Gemini was able to work through these steps successfully, creating an intuitive TextGrid boundary manipulation system.

Still, another critical problem required addressing.

Phase 9 & 10: Scripting & local directory mounting

I tested the script loading and execution with some sample scripts from my Phonetics class last semester. Not many tests were needed for me to discover that the script parser and interpreter were… basically not there.

Phase 9 was appended to the development plan to address these issues; it mostly focused on properly implementing a dynamic form ... endform input modal and local directory access via virtual filesystem mounting. Phase 10 addressed the file synchronization issue found after finishing phase 9, and added a browser download fallback for saving new files (generated from Praat script execution, etc.) to the user’s machine.

If you’re curious, you can find it (and the other phases) at the project’s agents.md.

Current project status

WebPraat currently still needs more overall testing. Its user manual hasn’t gone through human review as well. Most of Praat’s functionalities used often at my school, however, are implemented.

The Phonetics instructor at my school, much to my gratitude, provided me with a list of valuable feedback and potential improvements. I’m working on further polishing the application and aim to publish it as a teaching/learning tool by next semester (Spring 2027).