Title: | A Wrapper for the Phonetic Software 'Praat' |
---|---|
Description: | It allows running 'Praat' scripts from R and it provides some wrappers for basic plotting. It also adds support for literate markdown tangling. The package is designed to bring reproducible phonetic research into R. |
Authors: | Stefano Coretta [aut, cre] |
Maintainer: | Stefano Coretta <[email protected]> |
License: | MIT + file LICENSE |
Version: | 3.2.4 |
Built: | 2024-12-07 20:33:21 UTC |
Source: | CRAN |
It installs the Quarto extension Literate Markdown Tangler, which provides users with literate programming tools.
add_lmt()
add_lmt()
Nothing. Used for its side effects.
## Not run: add_lmt() ## End(Not run)
## Not run: add_lmt() ## End(Not run)
It opens a file or list of files in the 'Praat' GUI.
praat_open(...)
praat_open(...)
... |
A character vector with the path to the file. Include multiple vector arguments to open multiple files. |
Nothing. Used for its side effects.
## Not run: # Open a single file script <- system.file("extdata", "get-formants.praat", package = "speakr") praat_open(script) # Open multiple files wav <- system.file("extdata", "vowels.wav", package = "speakr") tg <- system.file("extdata", "vowels.TextGrid", package = "speakr") praat_open(wav, tg) ## End(Not run)
## Not run: # Open a single file script <- system.file("extdata", "get-formants.praat", package = "speakr") praat_open(script) # Open multiple files wav <- system.file("extdata", "vowels.wav", package = "speakr") tg <- system.file("extdata", "vowels.TextGrid", package = "speakr") praat_open(wav, tg) ## End(Not run)
Plot waveform and spectrogram
praat_plot( file, wav, tg = NULL, start = 0, end = NULL, width = 5, format = "png", f0 = FALSE, f0_min = 0, f0_max = 500, spec_max = 5000 )
praat_plot( file, wav, tg = NULL, start = 0, end = NULL, width = 5, format = "png", f0 = FALSE, f0_min = 0, f0_max = 500, spec_max = 5000 )
file |
Output file path as a string. |
wav |
Wav file path as a string. |
tg |
TextGrid file path as a string. If |
start |
Start time of the plotting window in seconds. |
end |
End time of the plotting window in seconds. If |
width |
Width of the plot in inches. |
format |
Output file format ( |
f0 |
Whether to plot f0 ( |
f0_min |
If |
f0_max |
If |
spec_max |
Maximum frequency for the spectrogram ( |
Nothing. It is used for its side effects.
## Not run: wav <- system.file("extdata", "vowels.wav", package = "speakr") praat_plot("vowels.png", wav, f0 = TRUE, f0_max = 200, end = 3) ## End(Not run)
## Not run: wav <- system.file("extdata", "vowels.wav", package = "speakr") praat_plot("vowels.png", wav, f0 = TRUE, f0_max = 200, end = 3) ## End(Not run)
It runs a 'Praat' script, with optional arguments passed to the script.
praat_run(script, ..., capture = FALSE)
praat_run(script, ..., capture = FALSE)
script |
A character vector containing the script name. |
... |
List of arguments to be passed to the script. |
capture |
If set to |
If the 'Praat' script returns standard output this is returned as a character vector. Also, if the script has instructions to create files, these will be created.
## Not run: script <- system.file("extdata", "get-formants.praat", package = "speakr") # Run get-formants.praat with argument "Hertz" and log to console. praat_run(script, "Hertz") # Run get-formants.praat with arguments and save in R variable. library(readr) formants <- praat_run(script, "Hertz", 0.03, capture = TRUE) %>% read_csv() ## End(Not run)
## Not run: script <- system.file("extdata", "get-formants.praat", package = "speakr") # Run get-formants.praat with argument "Hertz" and log to console. praat_run(script, "Hertz") # Run get-formants.praat with arguments and save in R variable. library(readr) formants <- praat_run(script, "Hertz", 0.03, capture = TRUE) %>% read_csv() ## End(Not run)
It opens the 'Praat' GUI.
start_praat()
start_praat()
Nothing. Used for its side effects.
## Not run: # Open Praat GUI. start_praat() ## End(Not run)
## Not run: # Open Praat GUI. start_praat() ## End(Not run)
This allows the user to save a copy of the Praat plotting script on disk so that they can make changes and customise the plot.
use_praat_plot_script(file, ...)
use_praat_plot_script(file, ...)
file |
Path including file name to which the script is copied. |
... |
Further arguments passed to |
Nothing. It is used for its side effects.