Author Topic: Pitch in praat  (Read 16948 times)

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Pitch in praat
« on: July 14, 2014, 09:49:57 PM »
In layman's terms (to the extent possible), how does Praat calculate pitch? It occurs to me that I have a wonderful time calculating intonation, but without an idea of what's going on behind the scenes, so to speak, I'm putting an awful lot of faith into this program... curious what's going on ! Thanks.

Offline Daniel

  • Administrator
  • Experienced Linguist
  • *****
  • Posts: 2090
    • English
Re: Pitch in praat
« Reply #1 on: July 14, 2014, 09:57:14 PM »
As far as I know it tries to locate F0, which should be within a particular range. I assume it uses some heuristics then finds an average across an interval. I'm not sure exactly what the algorithm is (but you can certainly look that up). Does that help at all?
Essentially, if you find the large band of voicing near the bottom of the spectrogram, that's pitch. Praat does the same thing mathematically.
Welcome to Linguist Forum! If you have any questions, please ask.

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Re: Pitch in praat
« Reply #2 on: July 14, 2014, 11:13:23 PM »
So pitch is f0 and/or voicing?

Offline jkpate

  • Forum Regulars
  • Linguist
  • *
  • Posts: 130
    • American English
    • jkpate.net
Re: Pitch in praat
« Reply #3 on: July 15, 2014, 12:19:59 AM »
It's really a misnomer for Praat to call it "pitch." What Praat calls "pitch" is f0. These are not the same; pitch is a psychoacoustic phenomenon, f0 is a property of periodic signals. Creaky voice is often perceived as low in pitch, but it has no periodicity at all.

Praat's f0 estimates are based on autocorrelation. At each time point in a signal, an autocorrelation looks back in time over a range of lags. The lag that achieves the highest correlation is the wavelength of the fundamental frequency. You have to specify how far back you are willing to look; these provide hard bounds on the highest and the lowest fundamental frequency you can find. This is why Praat requires you to provide the pitch range.

Note that this is not the same as looking for a voicing band in the spectrogram and finding its peak. That technique will fail if the voicing band does not exist. Telephone speech does not include energy below about 400 hz; there may be a lot of noise at low frequencies; and so on. Autocorrelation can still recover the fundamental frequency by relying on the harmonics. Even if the fundamental is gone, the signal will contain the harmonics, and they will all hit their peaks when the fundamental would have hit its peak (in the time domain) if it were there.
« Last Edit: July 15, 2014, 12:21:33 AM by jkpate »
All models are wrong, but some are useful - George E P Box

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Re: Pitch in praat
« Reply #4 on: July 15, 2014, 01:00:24 AM »
Thanks for clearing that up. I had the suspicion just based on my analysis of the spectrogram that pitch was really fundamental freq.

Here's a crazy-ish question: Is there a script that automatically recognizes e.g. rising/falling f0/pitch?

Offline jkpate

  • Forum Regulars
  • Linguist
  • *
  • Posts: 130
    • American English
    • jkpate.net
Re: Pitch in praat
« Reply #5 on: July 15, 2014, 01:07:43 AM »
There certainly are scripts for doing things with f0, but you'll have to define your problem more precisely. Do you want to find every place the f0 increases? Do you want to find the largest increase in an utterance? Do you want to decide whether the overall f0 contour went up or down in a given syllable? All of these require different approaches and different amounts of annotation. You probably won't find a script for exactly your needs that runs out of the box. However, you can look at the scripts by Pauline Welby and Christian DiCanio for good examples and ideas.
All models are wrong, but some are useful - George E P Box

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Re: Pitch in praat
« Reply #6 on: July 15, 2014, 01:22:22 AM »
Excellent tips for the scripts. Thanks a lot for that.

Humour me for a second (you're used to that by now) -- if I wanted to make a script that recognized e.g. polar interrogative formation pitches (e.g. rising pitch), would that be possible?

Would it be possible to do that in real-time? I know, crazy... but just curious.

Offline jkpate

  • Forum Regulars
  • Linguist
  • *
  • Posts: 130
    • American English
    • jkpate.net
Re: Pitch in praat
« Reply #7 on: July 15, 2014, 06:57:38 AM »
This sounds like it could be a pretty major undertaking. Pauline Welby has a pipeline of praat and R scripts for detecting F0 elbows, but that doesn't necessarily get you all the way to recognizing polar interrogatives. How clean is your audio? Do you need to distinguish a polar interrogative boundary tones from L+H* pitch accents?
All models are wrong, but some are useful - George E P Box

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Re: Pitch in praat
« Reply #8 on: July 16, 2014, 06:15:03 AM »
Well, I think/hope/believe that it's only a major undertaking if you assume I need 100% accuracy and no false positives / true negatives. Let's see I'm tolerant of both and I don't care about distinguishing polar interr boundary tones from L+H* pitch accents. In fact, all I care about is finding rising f0 phrase-finally.  Plausible, no?

Offline jkpate

  • Forum Regulars
  • Linguist
  • *
  • Posts: 130
    • American English
    • jkpate.net
Re: Pitch in praat
« Reply #9 on: July 16, 2014, 07:59:13 AM »
Is the system going to be told where the ends of the phrases are? Finding the ends of phrases automatically is not easy.
All models are wrong, but some are useful - George E P Box

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Re: Pitch in praat
« Reply #10 on: July 17, 2014, 02:10:56 AM »
no. basically in its simplest iteration it will not. it'll simply be a "rising f0 indicator", and then get tweaked from there.

Offline MalFet

  • Global Moderator
  • Serious Linguist
  • *****
  • Posts: 282
Re: Pitch in praat
« Reply #11 on: July 17, 2014, 08:36:41 AM »
no. basically in its simplest iteration it will not. it'll simply be a "rising f0 indicator", and then get tweaked from there.

Given the meager coding accuracy that this will produce, I have to say that I'm very skeptical this kind of automation is going to make things any easier than just pounding through all the data by hand.

Offline jkpate

  • Forum Regulars
  • Linguist
  • *
  • Posts: 130
    • American English
    • jkpate.net
Re: Pitch in praat
« Reply #12 on: July 17, 2014, 05:44:24 PM »
I agree with MalFet. F0 can increase for many reasons, including pitch accent (even if you aren't interested in finding pitch accents, they're a confound), the inherent noise in the autocorrelation algorithm, boundary tones for list intonation, cues to voicing contrasts in neighboring segments, and so on. Simply tracking f0 is not likely to provide a strong signal about intonation, especially if you don't have strong constraints on what the talkers can say or advance knowledge about where the phrase boundaries are.
All models are wrong, but some are useful - George E P Box

Offline zaba

  • Serious Linguist
  • ****
  • Posts: 272
Re: Pitch in praat
« Reply #13 on: July 17, 2014, 10:09:35 PM »
Right, I agree with your misgivings. Fair enough. But I think if I ask speakers to say just one sentence pair in my uni lab setting, e.g. "The dog wears a hat" and "The dog wears a hat?", the algorithm will select which one is the polar question. Obviously in natural speech it won't work so well because of interruptions, etc.

Offline MalFet

  • Global Moderator
  • Serious Linguist
  • *****
  • Posts: 282
Re: Pitch in praat
« Reply #14 on: July 17, 2014, 10:33:40 PM »
Can you write an algorithm that will identify which of two audio clips has the largest positive change in pitch near the end? Sure. If you've got that much control over your data, I'm not sure why automation is necessary/helpful, but there's nothing to stop you from doing it.

You'll still get foiled by things like phrase final devoicing, but under very ideal conditions what you're describing should work some of the time at least.