praat: Execute a Praat command

Description Usage Arguments Details Value Note Author(s) References See Also Examples

Description

Sends a shell command to the operating system that invokes the command-line form of Praat with an associated Praat script that imports a file, applies a Praat command to it, and then either brings the output directly into R or exports the output as a textfile.

Usage

1
praat( command, arguments, input, output, overwrite, filetype, simplify )

Arguments

command

A character string indicating what command should be executed. At present, 972 different commands can be applied to 100 of Praat's different object classes, for a total of 2163 unique combinations of command + object. For the full list, see http://www.aaronalbin.com/praatr/commands.html.

arguments

Only required for certain commands. A list() of the arguments to the Praat command. These must be in the exact same order as used in Praat. The components of the list can optionally be named, but these names are ignored by PraatR.

input

The path to the file that the specified Praat command takes as input. This should be the full path on your hard drive (not merely the file name) and must not contain any spaces.

output

Required for 'Create' commands, and optional for 'Modify' commands. The path for the file that will be created once the specified Praat command is executed. This should be the full path on your hard drive (not merely the file name) and must not contain any spaces. If omitted for a 'Modify' command, this will be assumed to be the same as the input argument.

overwrite

Only relevant for 'Create' and 'Modify' commands. If the file specified in 'output' already exists, indicates whether that file should be over-written with the file created by executing the Praat command. Defaults to FALSE for 'Create' commands and TRUE for 'Modify' commands.

filetype

Only relevant for 'Create' and 'Modify' commands. Determines what file format the output text file will have. All 'Create' and 'Modify' commands have three choices: "text", "short text", and "binary". ("short" can be used as an alias for "short text".) In addition, certain special file types are also allowed for certain commands (e.g. saving a Sound object in WAV format). See the 'Supported Commands' page on the PraatR site for information on which file types are allowed for which commands. When omitted, defaults to filetype="text".

simplify

Only relevant for 'Query' commands. If TRUE, the requested information will be brought into R as a text string (potentially along with additional information, e.g. the unit of a measurement). If FALSE, any such additional information will be removed, hence only the number data itself is returned (as a text string, which can then be passed to as.numeric(), etc.) When omitted, defaults to simplify=FALSE.

Details

The only two arguments that are obligatory (i.e. required for every possible command) are command (which command to execute) and input (what file to work with). Depending on the command, you may also need to provide the arguments required by Praat in order for it to know exactly how to execute that command. The rest of the arguments depend on what kind of command you are executing:

Value

This function is largely used for its 'side-effect' - controlling Praat. The exception is 'Query' commands, which return a value to R in one of two different formats. (See the documentation of the simplify argument above.)

Note

Further information - including installation instructions, a basic tutorial, and the list of supported commands - is available at the PraatR homepage: http://www.aaronalbin.com/praatr/.

Author(s)

Aaron Albin (http://www.aaronalbin.com/)

References

Albin, A. (2014). PraatR: An architecture for controlling the phonetics software "Praat" with the R programming language. Journal of the Acoustical Society of America, 135(4), 2198. http://scitation.aip.org/content/asa/journal/jasa/135/4/10.1121/1.4877175

See Also

PraatR

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# The following examples are commented out because the file paths need to be adjusted for your
#    computer (so the files and folders actually exist).

# Example 'Play' command
#praat( "Play", input="C:/sound.wav" )
# Has Praat read in the the soundfile 'C:/sound.wav' and then execute the 'Play' command on it

# Example 'Create' command
#praat( "Down to PitchTier", input="C:/sound.Pitch", output="C:/sound.PitchTier" )
# Takes a Pitch object, creates a PitchTier object out of it, and saves the result

# Example 'Modify' command
#praat( "Insert boundary...", input="C:/sound.TextGrid", arguments=list(1, 0.5) ) 
# Takes a TextGrid and inserts a boundary at 0.5 seconds ('0.5') on the first tier ('1')

# Example 'Query' command
#praat("Get mean...", input="C:/sound.Formant", arguments=list(1,0,0,"Hertz"), simplify=TRUE )
# Reads in a Formant object, retrieves the mean value of formant '1' from time '0' to time '0'
# (i.e. the entirety of the file), and returns only the number (omitting the suffix " Hertz")

usagi5886/PraatR documentation built on May 3, 2019, 2:37 p.m.