Generate simple MP4 video files with Praat Picture style plots of acoustic data with time-aligned transcriptions and embedded audio to use in presentations etc.
talking_praatpicture(
sound,
start = 0,
end = 0,
frames = c("sound", "spectrogram", "TextGrid"),
draw_lines = list("formant", h = seq(0, 10000, by = 1000), lty = "dotted"),
audio_start = start,
audio_end = end,
width = 1080,
height = 720,
pointsize = 25,
cursor = FALSE,
cursor_frameRate = 50,
cursor_color = "black",
cursor_lwd = 2,
verbose = TRUE,
outputFile = "praatvid.mp4",
useViewer = TRUE,
...
)No return value, produces a video file.
String giving the file name of a sound file with the .wav extension.
Start time (in seconds) of desired plotted area. Default is 0.
End time (in seconds) of desired plotted area. Default is 0
(= the entire file).
String or vector of strings giving the frames that the plot
should consist of. Default is sound, spectrogram, TextGrid. This
requires a file with the extension .TextGrid and the same base name as the
sound file. Other options are pitch, formant, and intensity. See
details for more information.
Use for drawing straight lines on plot components. Takes
an argument of type list which should contain a) a string giving the plot
component to draw straight lines on, and b) arguments to pass on to
graphics::abline. Should have a named argument h for horizontal lines,
or v for vertical lines, or a,b for the intercept and slope of the
line otherwise. Alternatively a nested list can be passed if more (sets of)
lines should be drawn. If multiple audio
channels are plotted and lines should be added to one of these,
use the channel identifier instead of a string giving the frame to draw on.
The default value is list('formant', h=seq(0,10000,by=1000), lty='dotted').
According to Praat defaults, this means that if formants are plotted in a
separate frame, horizontal dotted lines (lty) are shown at 1000 Hz
intervals. To override this behavior, simply pass draw_lines=NULL.
The argument is ignored if cursor = TRUE.
Start time (in seconds) of embedded audio. By default
it is the same as start, i.e. the embedded audio is the portion of the
sound file that is being plotted.
End time (in seconds) of embedded audio. By default it is
the same as end, i.e. the embedded audio is the portion of the sound
that is being plotted.
Number giving the desired width of the resulting animation in
pixels; default is 1080.
Number giving the desired height of the resulting animation in
pixels; default is 720.
Number; which point size should be used for text in the
animation? Default is 25. See grDevices::png() for more details.
Logical; should a moving cursor show the current position in
the sound file? Default is FALSE.
Number giving the desired number of frames per second
for moving cursor. Default is 50.
String giving the color of the moving cursor. Default is
black.
Number giving the line width of the moving cursor. Default
is 2.
Logical; should status messages be printed in the console as
figures are being generated? Default is TRUE.
String giving the desired file name. Default is
praatvid.mp4.
Logical; should the video be shown in the Viewer pane in
RStudio? Default is TRUE; if true, the video is oSnly saved in a
temporary directory, but can be downloaded from a browser.
Further arguments passed to praatpicture.
This function is a wrapper for av::av_capture_graphics() used to
produce plots similar to those made with praatpicture() with embedded
audio. For more detail on your
options, see the praatpicture() help file.
if (FALSE) {
datapath <- system.file('extdata', package='praatpicture')
soundFile <- paste0(datapath, '/1.wav')
talking_praatpicture(soundFile)
}
Run the code above in your browser using DataLab