This tutorial was adapted based on the examples from David R Feinberg

This tutorial assumes you started a Jupyter notebook . If you don't know what this is, here's a tutorial on how to set one up (first part)

First you should install the parselmouth package, which interfaces Praat with python:

`!pip install -U praat-parselmouth`

which you would then import:

```
import parselmouth
from parselmouth import praat
```

You do need some audio input (wav header, 16 kHz sample rate)

`testfile = '/home/felix/data/data/audio/testsatz.wav'`

And would then read in the sound with parselmouth like this:

`sound = parselmouth.Sound(testfile) `

Here's the code to extract the first three formant tracks, I guess it's more or less self-explanatory if you know Praat.

First, compute the occurrences of periodic instances in the signal:

```
f0min=75
f0max=300
pointProcess = praat.call(sound, "To PointProcess (periodic, cc)", f0min, f0max)
```

then, compute the formants:

`formants = praat.call(sound, "To Formant (burg)", 0.0025, 5, 5000, 0.025, 50)`

And finally assign formant values with times where they make sense (periodic instances)

```
numPoints = praat.call(pointProcess, "Get number of points")
f1_list = []
f2_list = []
f3_list = []
for point in range(0, numPoints):
point += 1
t = praat.call(pointProcess, "Get time from index", point)
f1 = praat.call(formants, "Get value at time", 1, t, 'Hertz', 'Linear')
f2 = praat.call(formants, "Get value at time", 2, t, 'Hertz', 'Linear')
f3 = praat.call(formants, "Get value at time", 3, t, 'Hertz', 'Linear')
f1_list.append(f1)
f2_list.append(f2)
f3_list.append(f3)
```

Thanks for the code.

May I know how I can do the process if I want to slice each formant value into 10%?

For example,

vowelstart= praat.call(sound, “Get starting time”)

vowelend= praat.call(sound, “Get end time”)

f1_10 = praat.call(formants, ‘Get value at time’, 1, vowelstart+(vowelend-vowelstart)*0.1, “Hertz”, “Linear”)

f2_10 = praat.call(formants, ‘Get value at time’, 2, vowelstart+(vowelend-vowelstart)*0.1, “Hertz”, “Linear”)

f3_10 = praat.call(formants, ‘Get value at time’, 3, vowelstart+(vowelend-vowelstart)*0.1, “Hertz”, “Linear”)

f1_20 = praat.call(formants, ‘Get value at time’, 1, vowelstart+(vowelend-vowelstart)*0.2, “Hertz”, “Linear”)

f2_20 = praat.call(formants, ‘Get value at time’, 2, vowelstart+(vowelend-vowelstart)*0.2, “Hertz”, “Linear”)

f3_20 = praat.call(formants, ‘Get value at time’, 3, vowelstart+(vowelend-vowelstart)*0.2, “Hertz”, “Linear”)

.

.

.

.

f1_90 = praat.call(formants, ‘Get value at time’, 1, vowelstart+(vowelend-vowelstart)*0.9, “Hertz”, “Linear”)

f2_90 = praat.call(formants, ‘Get value at time’, 2, vowelstart+(vowelend-vowelstart)*0.9, “Hertz”, “Linear”)

f3_90 = praat.call(formants, ‘Get value at time’, 3, vowelstart+(vowelend-vowelstart)*0.9, “Hertz”, “Linear”)