Skip to content

Instantly share code, notes, and snippets.

@macleginn
Last active July 16, 2016 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macleginn/fc8457bb1ea86b2655bec92ec77f6907 to your computer and use it in GitHub Desktop.
Save macleginn/fc8457bb1ea86b2655bec92ec77f6907 to your computer and use it in GitHub Desktop.
Praat editor script for plotting formants from the selected segment and printing their values along with the duration in the info window
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 the spectrogram.
To Formant (burg): 0, 5, 5000, 0.025, 50
Erase all
Draw tracks: 0, 0, 5500, "yes"
formantsInfo$ = List: "no", "yes", 5, "no", 3, "yes", 3, "yes"
appendInfo: formantsInfo$
removeObject: "Sound untitled"
removeObject: "Formant untitled"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment