Category Archives: Software

These include all my posts of software tools – mostly intended to our my research community

Ultrasound Video and Microphone Audio Capture

This is a simple set of one-line scripts for capturing ultrasound audio and video.

I built it to work as batch files through the WINDOWS OS command-line because that’s the OS that seems to give me the highest frame-rate. (I use macs, and this works with the windows OS booted from bootcamp).

Look at the README file to make sure you use the scripts properly.

As always, contact me if you have issues.



Crop and Segment Video

Here I offer you a program that will scan through all of the PRAAT textgrids in a folder, and for each it will search for the named textgrid tier.  Then it will loop through each segment in that tier, find the ones with text in them, and cut clips from a video with the exact same base-name based on those time stamps.  Each video will be cropped to the region given in the cropping variable (currently set for the Logiq E ultrasound).

The program uses R as a wrapper to load PRAAT textgrid files, uses a PERL program (copyright Theo Veenker <>) to make a CSV file usable in PRAAT, and work with that data.  

Therefore: 1) You have to extract audio from the video file you want to crop and segment, and transcribe and label that video in a PRAAT textgrid to the detail you want to use for each cropped video file (usually a word or phrase). 2) Go into the code, and change all the variables at the top according to your needs.

Lots of work, but this program will still save you heaps of time.  It is especially useful if you are using AAA for ultrasound analysis but only have video instead of AAA’s proprietary ultrasound file storage format.

Note, I provide sample data in the zip file to test the program – a swallow used for a palate trace.  Get the program to run with the sample before you modify it for your own purposes.

Aligning Audio and Video

Dealing with video files is just about the most obnoxious experience a researcher can have.  I wasted a *year* of research getting this one wrong before I realized the only, and I do mean only, effective solution involves FFMPEG.  Here I offer you a program that will re-align every video held in one directory and for which you have alignment data.

The program uses R as a wrapper to load a .csv file that contains the meta-data on a directory of video files that you want to align. 

Therefore: 1) You have to hand-check the audio-visual offsets for each file, and put that into the .csv file. 2) You also have to make sure you have installed FFMPEG, SOX, PERL, R, and the R modules “reader” and “gdata”. 3) You have to look inside my R-code and change the paths and extensions to make the program will work on your computer.

I provide a sample video with a swallow used to obtain a palate trace.  Get the software to work on your machine with this sample before modifying the code for your project.


Phoneme Quality

I rewrote a PRAAT script – shamelessly edited from Mietta’s amazing original – but modified to work well on both MAC and PC.  The scrip opens all the WAVE or AIFF files and matching textgrids, and take a look at the relevant tier (defaults to 3) to extract duration, f0 (pitch), F1, F2, F3, cog. The PRAAT script and readme file are located here

Mietta Lenne’s scripts, for those who don’t know, seem to be on Github these days.


TreeForm is a cross-platform syntax tree drawing software written in Java. TreeForm has been freely available as an open-source project since February 2006, and updated to its current form in 2010. To download, please go to the TreeForm site on

You can cite the use of TreeForm with this reference:

Derrick, D. and Archambault, D. (2010). TreeForm: Explaining and exploring grammar through syntax trees. Literary and Linguistic Computing, 25(1):53-66. doi: 10.1093/llc/fqp031.

You can also watch  the TreeForm video below.

In the spring of 2007, TreeForm was edited extensively and tested for suitability among a select group of linguists at UBC. A comparison of TreeForm along with other methods of drawing syntax trees, along with the cognitive walkthrough. I published the results with Daniel Archambault in Literary and Linguistic Computing as an article entitled TreeForm: Explaining and exploring grammar through syntax trees.

With TreeForm, you can create and reorder syntax trees with Unicode fonts, add features, case, associations and movement lines in black and white or color, and save the results for future editing or print to pdf for use in word processing or Latex documents. TreeForm itself has been used extensively by researchers all over the world.  Special thanks to all those who have helped make TreeForm a successful project, to my many users, and to the 136,000+ who have tried TreeForm since I uploaded it to SorceForge.

Minimal Pairs

I wrote this PERL script in order to output minimal pairs from a document.  To use this properly, you need to take a document and save it as text.  Then you need to substitute items in the text so that each phoneme has a unique ASCII code.  I highly recommend a key-item pair so you can convert the text back and forth as needed.

Then make sure that PERL is installed on your computer.

Then, from your command-line, go to the directory with both this .pl file AND your text file, and type in the relevant information in this format:

perl {input.txt} {output.txt} {difference} {minimum size}

difference should be kept at 1 unless you want non-minimal pairs (not well tested)

Minimum size represent the minimum word size you wish to capture.

Output will have columns of the minimal pairs with the structure

minimal pair 1 | minimal pair 2 | phoneme 1 | phoneme 2