Skip to content

Instantly share code, notes, and snippets.

@macleginn
Last active July 16, 2016 10:31
Show Gist options
  • Save macleginn/173e66288d50af44434e8d7fbbd508c3 to your computer and use it in GitHub Desktop.
Save macleginn/173e66288d50af44434e8d7fbbd508c3 to your computer and use it in GitHub Desktop.
Praat editor script for getting average values of the first three formants for the selected segment
Extract selected sound (time from 0)
endeditor
duration = Get total duration
writeInfoLine: fixed$ (duration, 3)
# Replace 5000 with 5500 for female voice.
# You may need to tweak the number of formants (2nd parameter) based on
# your data. Sometimes, if two formants are close to each other,
# it is necessary to ask for 6 formants so that they may be decoupled.
# In other cases, however, this may introduce spurious formants, and
# it is always advisable to check both the spectrogram and
# formant plot produced by the Draw command in the Object window
# (or by measureAndPlotFormants.praat).
To Formant (burg): 0, 5, 5000, 0.05, 50
for i from 1 to 3
f_i = Get mean: i, 0.0, 0.0, "Hertz"
appendInfoLine: f_i
endfor
removeObject: "Sound untitled"
removeObject: "Formant untitled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment