Praat scripting basics - PowerPoint PPT Presentation

About This Presentation
Title:

Praat scripting basics

Description:

Available for many different platforms (Windows, Macintosh, Unix, Linux) ... Slides on element types based on Praat scripting tutorial basics, Florian Jaeger ... – PowerPoint PPT presentation

Number of Views:216
Avg rating:3.0/5.0
Slides: 25
Provided by: paulin8
Learn more at: https://prosodia.upf.edu
Category:

less

Transcript and Presenter's Notes

Title: Praat scripting basics


1
Praat scripting basics
  • Pauline Welby
  • Coláiste na Tríonóide, Baile Átha Cliath
  • (Irlanda)
  • welbyp_at_tcd.ie

2
Praat scripting
  • Praat is a phonetic analysis software program
  • Available for many different platforms (Windows,
    Macintosh, Unix, Linux)
  • Can be downloaded (for free) from www.praat.org.
  • Includes a scripting language

3
Praat scripts
  • Do anything you can do in Praat by hand
  • Open, save, rename files, convert formats, etc.
  • Measure formants, F0, etc.
  • Resynthesize duration, F0, etc.
  • Draw figures
  • Label
  • Present stimuli and collect responses

4
Why script in Praat?
  • saves time
  • prevents errors (typos, data transfer errors)
  • makes errors easier/faster to correct
  • allows you to play around with different
    parameters

5
Detailed Praat scripting tutorial
  • Available on the web (Praat web page)
  • http//www.fon.hum.uva.nl/praat/manual/Scripting.h
    tml
  • or
  • From within Praat
  • In objects window
  • Help Praat intro
  • Search scripting

6
Keep in mind
  • Its easier to adapt an existing script (your own
    or someone elses) than to write one from
    scratch.
  • Many scripts freely available on the WebCheck
    sites
  • http//www.icp.inpg.fr/welby/PAGES/praat.html
  • (Pauline Welby, in French and English)
  • http//www.cavi.univ-paris3.fr/ilpga/ED/student/st
    cg/E
  • (Cedric Gendrot, in French)
  • http//www.helsinki.fi/lennes/praat-scripts(Miet
    ta Lennes, in English)
  • http//www.icp.inpg.fr/7Eloeven/ScriptsPraat.html
    (Hélène Loevenbruck, in French)
  • http//www.cphling.dk/pers/johtnd/praat/my_praat.h
    tm(John Tøndering, in English)
  • http//www.ling.ohio-state.edu/kyoon/scripts/praa
    t(Kyuchul Yoon, in English)
  • Also, try a Google search.

7
Opening a Praat script
  • To open an existing script in Praat Praat
    Open script...
  • Note Different from opening sound files,
    TextGrid files etc. (Read Read from file)

8
Lets try it
  • Open (read in) all sound files in a directory
  • Can do by hand (slowly and painfully)
  • Or use a script readin-files-simple.praat
  • - Praat Open script...
  • - Navigate to correct directory and find
    readin-files-simple.praat

9
  • Open the script
  • Starter1.praat

10
Elements in a script
  • Comments
  • Allow you to give descriptions of what each part
    of a script does
  • A very good idea! Helps you (and other users)
    understand how the script works
  • Also useful for testing and diagnostic purposes
  • Praat comment character
  • Praat ignores anything to the right of
  • This line reads in a sound file Read from
    file... finger.wav
  • This line does nothing!
  • Read from file... finger.wav

11
Elements in a script
  • Objects (are manipulated)
  • everything in object window (at left)
  • files
  • numbers
  • strings (letters, etc.)

12
  • Open the script
  • Starter2.praat

13
Elements in a script
  • Variables (a type of object)
  • Store values
  • Examples
  • ifile
  • numberOfFiles
  • fileName
  • Types number, string (text), boolean (yes/no or
    1/0)
  • Naming conventions
  • begin with lowercase letters
  • no spaces
  • string variables must end in

14
  • Open the script
  • Starter3.praat

15
Elements in a script
  • Functions (exist in Praat window menus)
  • Read from file
  • Write to file
  • Remove
  • Play
  • Some functions act on only certain types of
    objects and in certain environments (e.g., Edit
    window).
  • Naming conventions
  • - always begin with uppercase letters
  • - may have spaces
  • - functions that take arguments end in dots
    ()

16
Elements in a script
  • Commands (specific to Praat scripting language)
  • form, endform
  • select
  • print
  • clearinfo
  • if, endif
  • for, endfor
  • Naming conventions
  • - start with lowercase letters
  • - one word

17
Creating a Praat script from scratch
  • To create a new scriptPraat New script

18
History
  • Praat keeps track of what you do by hand
  • If you want to do something, but youre not sure
    of the syntax, do
  • in script window Edit Clear history
  • in objects window, select the object you want to
    work on and perform the operation. (Query Get
    duration)
  • in script window(Edit Paste history)

19
  • Open the script
  • Starter4.praat

20
Loops
  • Allow the same commands and functions to be
    executed over and over again (on a list of files,
    for example)
  • Created withfor, endforrepeat, until(and
    other pairs of commands)

21
Bug tracking
  • Error messages can be transparent
  • But often are not!
  • Practice fixing errors by introducing them
  • missing , misspelled/wrong case variable, hard
    return in form,
  • Use print command to print information to info
    window and find bugs. E.g.
  • print got here 'newline
  • print baseFile 'newline
  • Make changes and test incrementally
  • Save a backup script that works

22
Be (very!) careful
  • not to overwrite or delete important files!
  • Scripts are powerful and one mistake can wipe out
    days (weeks, months) of work in seconds
  • Keep backups of data
  • When writing/adapting a new script, work in a
    temporary directory

23
Acknowledgments
  • Slides on element types based on Praat scripting
    tutorial basics, Florian Jaeger
  • http//www.stanford.edu/tiflo/teaching/tutorials
    /T_Jaeger_042104-praat20scripting.htmslide0001.h
    tm

24
  • My new lab (as of October 1, 2008)Laboratoire
    Parole et LangageAix-en-Provence, France
  • My e-mail address will bepauline.welby_at_lpl-aix.f
    r
Write a Comment
User Comments (0)
About PowerShow.com