Script for listing F0 statistics

"I need to split the wave into 50 msec sections, and then for each of those sections get the F0 statistics. That is, for each 50 msec section of speech I want to get the average F0, min, max, and standard deviation."

First you create the complete pitch contour, i.e., you select the Sound and choose To Pitch.... You can then use the commands from the Query menu in a loop:

``` startTime = Get start time``` ``` endTime = Get end time``` ``` numberOfTimeSteps = (endTime - startTime) / 0.05``` ``` writeInfoLine: " tmin tmax mean fmin fmax stdev"``` ``` for step to numberOfTimeSteps``` ```    tmin = startTime + (step - 1) * 0.05``` ```    tmax = tmin + 0.05``` ```    mean = Get mean: tmin, tmax, "Hertz"``` ```    minimum = Get minimum: tmin, tmax, "Hertz", "Parabolic"``` ```    maximum = Get maximum: tmin, tmax, "Hertz", "Parabolic"``` ```    stdev = Get standard deviation: tmin, tmax, "Hertz"``` ```    appendInfoLine: fixed\$ (tmin, 6), " ", fixed\$ (tmax, 6), " ", fixed\$ (mean, 2),``` ```    ... " ", fixed\$ (minimum, 2), " ", fixed\$ (maximum, 2), " ", fixed\$ (stdev, 2)``` ``` endfor```

### Notes

One should not cut the sound up into pieces of 50 ms and then do To Pitch... on each of them, because Praat will not compute F0 values in the first or last 20 ms (or so) of each piece. This is because the analysis requires a window of 40 ms (or so) for every pitch frame. Instead, one typically does the analysis on the whole sound, then queries the resulting large Pitch object. In that way, the information loss of windowing only affects the two 20 ms edges of the whole sound.

The example writes lines to the Info window. If you want to write to a file instead, you start with something like

```    deleteFile: "~/results/out.txt"```

and add lines in the following way:

```    appendFileLine: "~/results/out.txt ", fixed\$ (tmin, 6), " ", fixed\$ (tmax, 6), " ",``` ```    ... fixed\$ (mean, 2), " ", fixed\$ (minimum, 2), " ", fixed\$ (maximum, 2), " ",``` ```    ... fixed\$ (stdev, 2)```