Create scrolling dynamic spectrogramsSource:
scrolling_spectro create videos of single row spectrograms scrolling from right to left sync'ed with sound.
scrolling_spectro(wave, file.name = "scroll.spectro.mp4", hop.size = 11.6, wl = NULL, ovlp = 70, flim = NULL, pal = seewave::reverse.gray.colors.1, speed = 1, fps = 50, t.display = 1.5, fix.time = TRUE, res = 70, width = 700, height = 400, parallel = 1, pb = TRUE, play = TRUE, loop = 1, lcol = "#07889B99", lty = 2, lwd = 2, axis.type = "standard", buffer = 1, ggspectro = FALSE, lower.spectro = TRUE, height.prop = c(5, 1), derivative = FALSE, osc = FALSE, colwave = "black", colbg = "white", spectro.call = NULL, annotation.call = NULL, ...)
object of class 'Wave'.
Character string with the name of the output video file. Must include the .mp4 extension. Default is 'scroll.spectro.mp4'.
A numeric vector of length 1 specifying the time window duration (in ms). Default is 11.6 ms, which is equivalent to 512 wl for a 44.1 kHz sampling rate. Ignored if 'wl' is supplied.
A numeric vector of length 1 specifying the window length of the spectrogram, default is NULL. If supplied, 'hop.size' is ignored.
Numeric vector of length 1 specifying the percent overlap between two consecutive windows, as in
spectro. Default is 70.
A numeric vector of length 2 specifying limits in the frequency axis (in kHz). Default is
NULL(which means from 0 to Nyquist frequency).
Character string with the color palette to be used. Default is 'reverse.gray.colors.1'.
Numeric vector of length 1 indicating the speed at which the sound file will be reproduced (default is 1, normal speed). Values < 1 (but higher than 0) slow down while values > 1 speed up. Note that changes in speed are achieved by modifying the number of frames per second in the output video. Hence, you may want to adjust 'fps' if video quality is considerably affected.
Numeric vector of length 1 specifying the number of frames per second.
Numeric vector of length 1 specifying the time range displayed in the spectrogram.
Logical argument to control if the time axis moves along with the spectrogram or remains fixed. Default is
Numeric vector of length 1 specifying the resolution of the image files (see
Numeric vector of length 1 specifying width of the video frame in pixels (see
png). Default is 700.
Numeric vector of length 1 specifying height of the video frame in pixels (see
png). Default is 400.
Numeric vector of length 1. Controls whether parallel computing is applied by specifying the number of cores to be used. Default is 1 (i.e. no parallel computing).
Logical argument to control if progress bar is shown. Default is
Logical argument to control if the video is played after generated. Default is
Logical argument to control if the video is formatted to be played in a loop (i.e. if ends at the start of the clip).
Character string with the color to be used for the vertical line at which sounds are played. Default is
Character string to control the type of the line at which sounds are played. Line types can either be specified as an integer (0=blank, 1=solid (default), 2=dashed, 3=dotted, 4=dotdash, 5=longdash, 6=twodash) or as one of the character strings "blank", "solid", "dashed", "dotted", "dotdash", "longdash", or "twodash", where "blank" uses 'invisible lines' (i.e., does not draw them).Default is 2.
Character string to control the width of the line at which sounds are played. Default is 2.
Character string to control the style of spectrogram axes. Currently there are 3 options:
standard: Both Y and X axes are printed as in the default
minimal: Single lines are used to denote the range defined by 1 s and 1 kHz for the X and Y axes respectively.
none: No axis is printed (also removes ticks, tick labels, and axis labels).
Numeric vector of length 1 (> 0) specifying the time to delay the start of the spectrogram scrolling (in seconds). Default is 1. Not available when loop is > 1.
Logical argument to control if a ggspectro (
ggspectro) is used instead. Note that there is much less control on display parameters when
ggpsectro = TRUE. Default is
Logical argument to control if a spectrogram of the full wave object is plotted at the bottom of the graph. Default is
Numeric vector of length 2 to control the relative height of the scrolling and lower spectro, respectively. Default is
c(5, 1). Ignored if
lower.spectro = FALSE.
Logical argument to control if spectral derivative is used instead of spectrogram (as in Sound Analysis Pro, see
deriche). Default is
Logical argument to control if the oscillogram is plotted at the bottom of the spectrogram. Default is
FALSE. Note that 'osc' and 'lower.spectro' are mutually exclusive.
Character string to control the color of the oscillogram. Default is 'black'.
Character string to control the background color. Default is 'white'.
A call from
textgenerated by the function
call. The call should also include the argmuents 'start' and 'end' to indicate the time at which the labels are displayed (in s).'fading' is optional and allows fade-in and fade-out effects on labels (in s as well). The position ('x' and 'y' arguments) should be between 0 and 1:
x = 0, y = 0corresponds to the bottom left and
x = 1, y = 1corresponds to the top right position.
Additional arguments to be passed to
spectrofor customizing spectrograms. Note that 'scale' cannot be included.
The function creates videos (mp4 format) of single row spectrograms scrolling from right to left. The audio is sync'ed with the spectrograms.
Araya-Salas M & Wilkins M R. (2020). dynaSpec: dynamic spectrogram visualizations in R. R package version 1.0.0.
Marcelo Araya-Salas (email@example.com)