0

I'm new to Praat scripting, and I was wondering if there was a way to "find" a word in a text grid tier and then find a sound in a different tier. I want praat to measure the last vowel in selected words in a large corpus (for which I have text grids). I've googled this but can't seem to find anything. If this isn't possible, would it be possible to find this in perl and then use Praat to find formants? Thanks!

2
  • Can you clarify the question a bit? E.g. do you know how to write a basic Praat script; is the problem identifying "last vowel of a word" given a text grid, what do you want to measure. You can use "system" or "system_nocheck" to call up any kind of external routine.
    – user6726
    Dec 1 '15 at 17:52
  • Sure - I know some about Praat scripting, but I think I know more about perl (though still a beginner!) I have a sound and a text grid with multiple tiers (one for words, one for phones, and some other stuff). I want to do some kind of "search" where I can input a word that praat will find in the word tier. Then, I want it to find the last vowel in the phone tier and measure the midpoint of the vowel.
    – Lisa
    Dec 1 '15 at 18:02
3

As I understand your question, there are four different tasks:

  1. Look for a word in a TextGrid tier

  2. Find its last vowel

  3. Look for the interval labelled with that vowel in the segment tier

  4. Measure something on that interval

The first and the third seem to me to be on-topic for this question.

1. Find a label in a tier

This is pretty straightforward. The most naive way to do this would be

n = Get number of intervals: word_tier
for i to n
  label$ = Get label of interval: word_tier, i
  if label$ == target$
    index = i 
    i += n ; break from the loop
  endif
endfor
appendInfoLine: "My label is on interval ", index

Alternatively, you could use the commands provided in the "tgutils" plugin distributed through CPrAN (full disclaimer: I wrote it). With it, you can include the procedures in find_labels.proc (or just copy the contents of that file into your script) and write

selected("TextGrid")
@findLabel: word_tier, target$
word_index = findLabel.return
appendInfoLine: "My word is on interval ", word_index

3. Finding the vowel interval

You'd then have to do the same but looking only among the intervals that fall within the boundaries of that word for the one that is labelled like the vowel you want.

For this, you can once again use the procedures from the "tgutils" plugin to look backwards for the first interval labelled with that vowel:

# Find the interval number in the segment tier at the end
# of the matching word in the word tier
word_end = Get end point: word_tier, word_index
last_segment = Get low interval at time: segment_tier, word_end

@findLabelBehind: segment_tier, last_vowel$, last_segment
segment_index = findLabelBehind.return
appendInfoLine: "My segment is on interval ", segment_index

The other tasks

Finding the last vowel, and running your analyses, are not within the scope of this question, based on your title. Feel free to create new questions to cover those, or to rephrase the scope of this one!

1
  • 1
    This is an excellent answer that is not getting the attention it deserves.
    – robert
    Dec 10 '15 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.