900 likes | 1.65k Views
Praat. LING115 November 4, 2009. Getting started. Basic phonetic analyses with Praat Creating sound objects Recording, reading from a file, creating from formula Analyzing sound objects Selection Pitch, intensity, formants Drawing Sound wave, pitch/intensity/formant contours Saving.
E N D
Praat LING115 November 4, 2009
Getting started • Basic phonetic analyses with Praat • Creating sound objects • Recording, reading from a file, creating from formula • Analyzing sound objects • Selection • Pitch, intensity, formants • Drawing • Sound wave, pitch/intensity/formant contours • Saving
Sampling frequency Number of samples taken per second Higher sampling frequency More accurate digitization A larger sound file 22050Hz is enough for speech analysis Recording
Reading from a file • Supported file types • .wav • .aiff • .au • etc. • Use “Open long sound file...” if the file is longer than two minutes
Sound object is the object that will be analyzed, manipulated, ... Sound object
Zoom in to selection (sel) Zoom out to view all (all) Zoom to selection
Pitch analysis will find values only within the specified range Pitch range settings
Some dB levels Whisper, 5ft = 30dB Normal conversation = 60dB Threshold of pain = 130dB Intensity range settings
Segmentation and labeling • TextGrid in Praat • Creating (interval) tiers • Adding intervals • Labeling intervals • Extracting values within the interval • Exercise • F1 and F2 extraction from TextGrid • Creating a vowel chart
Starting the TextGrid Editor • Select both the sound object and the textgrid object • Click on the sound object • Hold the Ctrl-key • Click on the textgrid object • Click “Edit”
Selecting tiers • Click on the tier or • View > • Select next tier • Select previous tier
Adding intervals • Click on the part of the wave form where you wish to mark the boundary • Click on the small ring in the tier where you wish to add the interval or Interval > Add interval on tier (tier-level)
Labeling the interval • Click on the tier or the interval within a tier • Make sure the part that you want to edit is highlighted in yellow • Type in the text to label the interval
X-SAMPA • A phonetic transcription system using ASCII characters • http://en.wikipedia.org/wiki/Xsampa
Information within the interval • Select the interval • Make sure relevant information is set to be displayed • e.g. Turn on “Show intensity” • Choose the desired menu to extract information related to the selected interval • e.g. “Get intensity”
Praat scripting • Object selection • Commands, arguments • Language elements • Variables, formulas, jumps, loops • Listing multiple files in a directory • Scripting an editor from a shell script
Why? • To save time and energy from repeating same/similar processes
Reference NB: Some of the examples are outdated
Basic idea, for example • Suppose we had a sequence of commands that we want to run repeatedly • e.g. “ Read from file > Select object > Play “ • We list the sequence of commands (with arguments if necessary) • We specify how and under which conditions we want to run the sequence of commands • e.g. Repeat over the entire list of .wav files in the directory (folder)
Getting started • Or use your favorite text editor before you run the script
Info window • You can print out the extracted information or messages to the “Info” window • echo <text> • clearinfo • print <text> • printline <text>
Object selection • select <type> <name> • select Sound 2500_1 • plus <type> <name> • plus Sound 2500_10 • minus <type> <name> • minus Sound 2500_1 • select all • Remove
Object selection – (2) • Objects have sequential ID, which begins from 1 since the program started • {select, plus, minus} <ID> • e.g. select 3, plus 3, minus 3 • You can save the name, type+name, and ID of the selected object to a variable • name$=selected$(“Sound”) or selected$(“Sound”,2) • fullname$=selected$() or selected$(2) • id=selected (“Sound”, -1) • The positive numbers are counted from the top of the object list • The negative numbers are counted from the bottom of the object list
Once one or more objects are selected (or even when there is no object selected), you can choose from a set of menus or commands Some of these do not require any arguments to be specified e.g. Play, Info, Edit, etc. For others, arguments should be specified e.g. Query > Get mean... Commands
Commands – (2) • For commands without arguments, you can simply type the command in a separate line in the script • e.g. Play
Commands – (3) • For commands with arguments, you must specify all the arguments in the script • <command>... <arg1> <arg2> ... <arg_n> • Arguments are separated by space • If an argument contains a space, it must be in double quotes • For check-box, “yes” to check and “no” to uncheck • For radio button, write the text next to the radio button you wish to select • Arguments are ordered left to right, top to bottom
Comments and white space • White space (space and tab) at the beginning is ignored • Start a line by #, !, or ; to add comments • e.g. # The next line does x,y,z
Variables • Numeric variables • Variable name must start with a lower case letter • i=2 • String variables • Variable name must start in lower case and end with $ • i$=“hello” • Variables must be initialized before use • Variables in single quotes can substitute parts of a string • name$=selected$(“Sound”,-1) • echo The name of the sound is ‘name$’
Variables – (2) • You can store the value from query commands, for example, in a variable • Query commands are the commands that appear under “Query-” • mean = Get mean... All 0.0 0.0 • If you don’t store the value in a variable, it will be printed on the Info window
Formulas • Numbers • length=2 • height=8 • area=length*height/2 • Strings (there may be more...) • a$=“hello,” • b$=“ world!” • c$=a$+b$ (concatenate a$ and b$) • d$=a$-”o” (right strip the string from a$)
Formulas – (2) • When a formula is used as an argument, you must make sure there is no white space between the terms in the formula • e.g. Get mean... length/2 length • Unless the formula is in double quotes • e.g. Get mean... “length / 2” length
Jumps • An if-then construct • begins with if <expression> and ends with endif • may have elsif <expression> or else in between • Example if age<=3 length=1.20 elsif age<=8 length=1.60 else length = 2.0 endif
“For” loops • Repeats the statements within the “for” loop while variable takes on a value between <expression1> and <expression2> for <variable> from <expression1> to <expression2> <statement_1> <statement_2> ... endfor
“Repeat” loops • Repeats the statements between repeat and until, while the <expression> after until is false repeat <statement_1> <statement_2> ... until <expression>
“while” loops • Statements between while <expression> and endwhile are repeated until <expression> is no longer true while <expression> <statement_1> <statement_2> ... endwhile