View source: R/draw_spectralslice.R
| draw_spectralslice | R Documentation |
Generate and plot spectral slice from window around a specified time point of a sound file.
draw_spectralslice(
sound,
time,
channel = 1,
freqRange = NULL,
energyRange = 60,
scale = "hz",
method = "fft",
multitaper_args = NULL,
windowLength = 0.005,
windowShape = "Gaussian",
color = "black",
lineWidth = 1,
freq_axisLabel = NULL,
energy_axisLabel = "Sound pressure level (dB/Hz)",
mainTitle = "",
mainTitleAlignment = 0,
highlight = NULL,
draw_lines = NULL,
draw_rectangle = NULL,
draw_arrow = NULL,
annotate = NULL,
...
)
sound |
String giving the file name of a sound file with the .wav extension. |
time |
Time (in seconds) specifying the center of the window from which to estimate spectrum. |
channel |
Numeric giving the channel that should be used to
generate the spectrogram. Default is |
freqRange |
Vector of two numbers giving the frequency range to be
used for plotting spectrograms. Default is |
energyRange |
Either numeric or vector of two numbers used to specify
the y-axis range in units of dB/Hz. If a single number is passed, this is
interpreted as the desired dynamic range of the y-axis. If a vector of
two numbers is passed, these are used to exactly delimit the y-axis.
Default is |
scale |
String giving the frequency scale to use. Default is |
method |
String specifying the spectral estimation. Default is |
multitaper_args |
Optional named list of arguments passed on to
multitaper::spec.mtm if |
windowLength |
Window length in seconds for generating spectra.
Default is |
windowShape |
String giving the name of the window shape to be
applied to the signal when generating spectrograms. Default is |
color |
String giving the name of the color to be used for plotting
the spectrum. Default is |
lineWidth |
Number giving the line width to use for plotting
the spectrum. Default is |
freq_axisLabel |
String giving the name of the label to print along the
y-axis when plotting a spectrogram. Default is |
energy_axisLabel |
String giving the name of the label to print along
the y-axis. Default is |
mainTitle |
String giving a title to print at the top of the plot. The default is an empty string, i.e. no title. |
mainTitleAlignment |
Number indicating the vertical alignment of the
plot title, where |
highlight |
Named list giving parameters for differential highlighting
of part of the plot based on the frequency domain. This list should contain
information about which parts of the plot to highlight, done with the
|
draw_lines |
Use for drawing straight lines. Takes
an argument of type |
draw_rectangle |
Use for drawing rectangles. Should be a named list containing arguments to pass on to graphics::rect. Can also be multiple nested lists, if more rectangles should be drawn. |
draw_arrow |
Use for drawing arrows on plot components. Should be a named list containing arguments to pass on to graphics::arrows. Can also be multiple nested lists, if more rectangles should be drawn. |
annotate |
Use for annotating plot components. Should be a named list containing arguments to pass on tographics::text. Can also be multiple nested lists, if more annotations should be added. |
... |
Further global plotting arguments passed on to |
No return value, produces a figure.
datapath <- system.file('extdata', package='praatpicture')
soundFile <- paste0(datapath, '/1.wav')
draw_spectralslice(soundFile, time = 0.75)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.