praat ling115 november 4, 2009. getting started basic phonetic analyses with praat –creating sound...

53
Praat LING115 November 4, 2009

Upload: junior-fleming

Post on 05-Jan-2016

215 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Praat

LING115November 4, 2009

Page 2: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 3: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Recording

• Sampling frequency– Number of samples taken per second– Higher sampling frequency

• More accurate digitization• A larger sound file

– 22050Hz is enough for speech analysis

Page 4: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Reading from a file

• Supported file types– .wav– .aiff– .au– etc.

• Use “Open long sound file...” if the file is longer than two minutes

Page 5: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Sound object

• Sound object is the object that will be analyzed, manipulated, ...

Page 6: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Sound editor window

Page 7: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Selection

Page 8: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Zoom to selection

• Zoom in to selection (sel)

• Zoom out to view all (all)

Page 9: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Pitch

Page 10: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Pitch range settings

• Pitch analysis will find values only within the specified range

Page 11: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Pitch extraction (in selection)

Page 12: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Intensity

Page 13: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Intensity range settings

• Some dB levels– Whisper, 5ft

= 30dB– Normal

conversation = 60dB

– Threshold of pain = 130dB

Page 14: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Intensity listing

Page 15: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Formants

a e i o u

F1 (Hz)

1000 500 320 500 320

F2 (Hz)

1400

2300

2500

1000 800

Frequency (Hz)0 11025

-20

0

20

Page 16: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Formant listing

Page 17: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Drawing – sound wave

Page 18: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Drawing – pitch contour

Page 19: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Drawing – intensity contour

Page 20: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Drawing – formant contour

Page 21: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Saving picture

Page 22: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 23: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Creating a TextGrid

Page 24: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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”

Page 25: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

TextGrid Editor

Page 26: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Selecting tiers

• Click on the tier

or

• View >– Select next tier– Select previous tier

Page 27: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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 intervalorInterval > Add interval on tier (tier-level)

Page 28: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 29: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

X-SAMPA

• A phonetic transcription system using ASCII characters

• http://en.wikipedia.org/wiki/Xsampa

Page 30: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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”

Page 31: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 32: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Why?

• To save time and energy from repeating same/similar processes

Page 33: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Reference

NB: Some of the examples are outdated

Page 34: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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)

Page 35: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Getting started

• Or use your favorite text editor before you run the script

Page 36: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Info window

• You can print out the extracted information or messages to the “Info” window

• echo <text>• clearinfo• print <text>• printline <text>

Page 37: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 38: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 39: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Commands

• 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...

Page 40: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Commands – (2)

• For commands without arguments, you can simply type the command in a separate line in the script– e.g. Play

Page 41: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 42: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 43: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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$’

Page 44: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 45: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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$)

Page 46: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

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

Page 47: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Jumps• An if-then construct

– begins with if <expression> and ends with endif

– may have elsif <expression> or else in between

• Exampleif age<=3

length=1.20elsif age<=8

length=1.60else

length = 2.0endif

Page 48: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

“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

Page 49: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

“Repeat” loops

• Repeats the statements between repeat and until, while the <expression> after until is false

repeat<statement_1><statement_2>...

until <expression>

Page 50: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

“while” loops

• Statements between while <expression> and endwhile are repeated until <expression> is no longer true

while <expression><statement_1><statement_2>...

endwhile

Page 51: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Listing filenames from a directory

• Create Strings as file list... <arg_1> <arg_2>– <arg_1> = name of the list– <arg_2>

• Directory, e.g. C:\linguistics\• Directory and the file type, e.g. C:\linguistics\*.wav

• “Edit” to view the listed filenames• “Get number of strings” to see how many

filenames are in the list• “Get string... <index>” to retrieve individual

filenames

Page 52: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Examplepath$="C:\temp\"Create Strings as file list... temp 'path$'select Strings tempnumfiles=Get number of stringsfor i from 1 to numfiles

select Strings tempfilename$=Get string... ifullname$=path$+filename$Read from file... 'fullname$'soundname$=filename$-".wav"select Sound 'soundname$'Play

endforselect allRemove

Page 53: Praat LING115 November 4, 2009. Getting started Basic phonetic analyses with Praat –Creating sound objects Recording, reading from a file, creating from

Scripting an editor

• You can switch from the Praat objects window to the Editor window, and include the editor commands in your script

Editeditor <object_type> <object_name>

Editor-specific commands...

endeditor