ReadPitch: Read a Pitch object into R

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

View source: R/ReadPitch.r

Description

This function takes a Pitch object textfile, reads it into R in a quick and efficient way, and returns the requested information.

Usage

1
ReadPitch( File, Return = "Frames" )

Arguments

File

Path to a Pitch object stored on one's computer. This must be stored in Praat's "text" format (and not "short (text)" or "binary" format). This file path does *not* have to be a full path, and it *can* have spaces in it.

Return

Specifies the kind of information about the Pitch object to be brought into R. See "Details" section below.

Details

Three values are accepted for Return:

Header All the info from the header (in the same order)
Frames Information about each frame (and each frame's highest-ranking candidate)
Candidates Information about every candidate in each frame

The default is "Frames" since it represents the most common use case.

Value

If Return="Header":

A list with the following entries: FileStartTime, FileEndTime, nFrames, TimeStep, FirstTime, Ceiling, MaxNumberCandidates

If Return="Frames":

A dataframe with the following columns: Time, Frequency, Intensity, Strength, nCandidates

If Return="Candidates":

A dataframe with the following columns: nthFrame, nthCandidate, Frequency, Strength

The default is "Frames" since it represents the most common use case.

Author(s)

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

References

This function is referenced on page 55 of

See Also

This function is called from within RichVisualization and F0RangeFinder in order to generate the F0 tracks. For creating Pitch objects in the first place, see ToPitch.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
# Create path to sample Pitch object textfile ('HelloWorld.Pitch') included in the package
PitchPath = paste(R.home("library"),"intonation","HelloWorld.Pitch",sep="/")

# Return the information contained in the header of the Pitch object
# More specifically, this queries the file's start/end time, the total number of frames, the time step, the timestamp of the first sample, the F0 ceiling, and the maximum number of candidates per frame.
Header = ReadPitch( PitchPath, Return="Header" )
print(Header) # Inspect the results

# Return information about the frames in the Pitch object.
# More specifically, this queries the time, frequency, intensity, strength, and number of candidates in each frame.
Frames = ReadPitch( PitchPath, Return="Frames" )
fix(Frames) # Inspect the results

# Return="Frames" is the default, hence the previous line is equivalent to
Frames = ReadPitch( PitchPath )

# Return information about the F0 candidates in the Pitch object.
# More specifically, this queries which frame each candidate is in as well as the candidate ranking, frequency, and strength of each candidate.
Candidates = ReadPitch( PitchPath, Return="Candidates" )
fix(Candidates) # Inspect the results

usagi5886/intonation documentation built on Dec. 9, 2019, 3:46 a.m.