Description Usage Arguments Details Value Examples
extract some pitch variables via Praat from audio (segments)
1 2 |
sound_file |
character, path to audio file |
child |
logical, should pitch settings be set for child (default), or adult |
time_range |
numeric of length 2, optional start and end time in
seconds. If left blank ( |
pathtopraat |
character, the path to the Praat binary |
unit |
character, the unit for the frequency measures ( |
pathtosox |
character, optional path to sox binary (only required if
|
The output reflects measures of F0 (actually, pitch): mean, 5 percentile and 95
The pitch settings for child versus adult are the following. Child: floor = 150 Hz, ceiling = 650 Hz. Adult: floor = 75 Hz, ceiling = 400 Hz. Time step for both is 0.01 s.
For this function to work, you need Praat, and you need to know where the
Praat
binary is located. On a Mac the location is likely to be
"/Applications/Praat.app/Contents/MacOS/Praat", and on Windows
"C:/Program Files/Praat.exe".
The function produces and executes a short Praat script:
Read from file: "myfile.wav"
To Pitch: 0.01, 150, 600
Get total duration
Get mean: 0, 0, "ERB"
Get quantile: 0, 0, 0.95, "ERB"
Get quantile: 0, 0, 0.05, "ERB"
The second line is adapted according to whether the assigned speaker of the
audio segment is a child (as in the example above) or an adult (in which case
that line will be To Pitch: 0.01, 75, 400
)
a data frame with one row
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ## Not run:
# requires Praat installed
# location to Praat on my machine:
ploc <- "/Applications/Praat.app/Contents/MacOS/Praat"
# example sound
sound_file <- system.file("synthetic_speech.wav", package = "avutils")
praat_pitch(sound_file, child = FALSE, pathtopraat = ploc)
praat_pitch(sound_file, child = TRUE, pathtopraat = ploc)
# analyse only subset requires sox installed
sloc <- "/usr/local/bin/sox"
praat_pitch(sound_file, time_range = c(0.3, 3.1), child = FALSE,
pathtopraat = ploc, pathtosox = sloc)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.