Description Usage Arguments Details Value Note Author(s) References See Also Examples
This function takes a soundfile, conducts an F0 analysis, and produces a Praat-format Pitch object using various customizable analysis parameters. As such, this function serves as a high-level interface to Praat's "Sound: To Pitch..." command, using the PraatR package.
1 2 3 4 5 6 7 8 9 10 11 12 13 14  | 
Input | 
 Path to a WAV file on one's computer containing the audio data from which the F0 should be extracted.  | 
Output | 
 Path to the Pitch object textfile that will be created as an end-product of using this function.  | 
Overwrite | 
 Logical variable determining whether the file will be overwritten if the   | 
FileType | 
 Which of Praat's output formats the Pitch object data should be saved as - either   | 
Range | 
 The F0 range (in Hertz) for the F0 analysis, specified as a vector, e.g.   | 
TimeStep | 
 The size of the time step (or 'frame') for the analysis, in milliseconds. The default of 0.001 means an F0 value will be extracted at every millisecond.  | 
MaxNumberOfCandidates | 
 The maximum number of candidate F0 values in each frame. The default value here (15) follows Praat's default. Setting this to 2 will save disk space and will not affect most analyses.  | 
VeryAccurate | 
 This and all of the remaining arguments are Praat's "advanced pitch settings", with default values matching those of Praat.  | 
SilenceThreshold | 
 "  | 
VoicingThreshold | 
 "  | 
OctaveCost | 
 "  | 
OctaveJumpCost | 
 "  | 
VoicedUnvoicedCost | 
 "  | 
The Input and Output arguments must both be full file paths (i.e., you can't rely on R's working directory functionality). These file paths also must contain no spaces (due to a limitation in the current implementation of PraatR).
None. This function is used for its side-effect: creating a new textfile at the location specified in Output.
Praat has the following five different commands for extracting F0. (Of these, #1 is just a high-level convenience wrapper/interface to #2.)
To Pitch...
To Pitch (ac)...
To Pitch (cc)...
To Pitch (SPINET)...
To Pitch (shs)...
The present function invokes Praat with command #2.
Aaron Albin (http://www.aaronalbin.com/)
This function is referenced on page 55 of
Albin, A. (2015). Typologizing native language influence on intonation in a second language: Three transfer phenomena in Japanese EFL learners. (Doctoral dissertation). Indiana University, Bloomington. http://dx.doi.org/10.5967/K8JW8BSC
To read the Pitch object textfile created by this function back into R, see ReadPitch. Note also that this function is used in the code for F0RangeFinder to perform the F0 analyses.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29  | # Create path to sample wave file ('HelloWorld.wav') included in the package
WavePath = paste(R.home("library"),"intonation","HelloWorld.wav",sep="/")
# Swap out '.wav' for '.Pitch' to make a path where the Pitch object should be created
PitchPath = sub(WavePath, pattern=".wav", replacement=".Pitch", fixed=TRUE)
# Determine the F0 range for the file in question
Range = c(69,135)
## Not run: 
# Run the 'To Pitch...' command with default arguments
ToPitch( Input=WavePath, Output=PitchPath, Range=Range )
# To allow over-writing of files, set 'Overwrite' to TRUE
ToPitch( Input=WavePath, Output=PitchPath, Range=Range, Overwrite=TRUE )
# To save in another Praat export format, set the 'FileType' argument
ToPitch( Input=WavePath, Output=PitchPath, Range=Range, FileType="short text" ) # Equivalent to "short"
ToPitch( Input=WavePath, Output=PitchPath, Range=Range, FileType="binary" )
# Adjust time step
ToPitch( Input=WavePath, Output=PitchPath, Range=Range, TimeStep=0.01 ) # 10 ms (sparser, hence faster)
# Adjust various advanced analysis parameters
ToPitch( Input=WavePath, Output=PitchPath, Range=Range, VeryAccurate=TRUE )
# MaxNumberOfCandidates, SilenceThreshold, VoicingThreshold, OctaveCost, OctaveJumpCost, and VoicedUnvoicedCost also be adjusted in a similar way
## End(Not run)
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.