specplot {praatpicture} | R Documentation |
Plot spectrogram
Description
Function for plotting spectrograms called by praatpicture. Instead of using
this function directly, just use
praatpicture('my_sound_file', frames='spectrogram')
.
Usage
specplot(
sig,
sr,
t,
start,
end,
tfrom0 = TRUE,
freqRange = c(0, 5000),
windowLength = 0.005,
dynamicRange = 60,
timeStep = 1000,
windowShape = "Gaussian",
colors = c("white", "black"),
pitch_plotOnSpec = FALSE,
pt = NULL,
pitch_plotType = "draw",
pitch_scale = "hz",
pitch_freqRange = NULL,
pitch_axisLabel = NULL,
pitch_color = "black",
formant_plotOnSpec = FALSE,
fm = NULL,
formant_plotType = "speckle",
formant_dynamicRange = 30,
formant_color = "black",
intensity_plotOnSpec = FALSE,
it = NULL,
intensity_range = NULL,
intensity_axisLabel = "Intensity (dB)",
intensity_color = "black",
tgbool = FALSE,
lines = NULL,
focusTierColor = "black",
focusTierLineType = "dotted",
ind = NULL,
min_max_only = TRUE,
axisLabel = "Frequency (Hz)"
)
Arguments
sig |
Numeric vector corresponding to a sound signal. |
sr |
Integer giving the sampling rate of the signal. |
t |
Numeric vector giving times corresponding to the signal. |
start |
Start time (in seconds) of desired plotted area. |
end |
End time (in seconds) of desired plotted area. |
tfrom0 |
Logical; should time on the x-axis run from 0 or from the
original time? Default is |
freqRange |
Vector of two integers giving the frequency range to be
used for plotting spectrograms. Default is |
windowLength |
Window length in seconds for generating spectrograms.
Default is |
dynamicRange |
Dynamic range in dB for generating spectrograms. The
maximum intensity minus |
timeStep |
How many time steps should be calculated for spectrograms?
Default is |
windowShape |
String giving the name of the window shape to be applied
to the signal when generating spectrograms. Default is |
colors |
Vector of strings giving the names of colors to be used
for plotting the spectrogram; default is |
pitch_plotOnSpec |
Boolean; should pitch be plotted on top of
spectrogram? Default is |
pt |
Pitch object loaded using rPraat::pt.read or similar object. |
pitch_plotType |
String giving the type of pitch plot to produce; default
is |
pitch_scale |
String giving the frequency scale to use when producing
pitch plots. Default is |
pitch_freqRange |
Vector of two integers giving the frequency range to be
used for producing pitch plots. Default is |
pitch_axisLabel |
String giving the name of the label to print along the
y-axis when printing a pitch track. Default is |
pitch_color |
String or vector of strings giving the name of the color
to be used for plotting pitch. Default is |
formant_plotOnSpec |
Boolean; should formants be plotted on top of
spectrogram? Default is |
fm |
Formant object loaded using rPraat::formant.read or similar object. |
formant_plotType |
String giving the type of formant plot to produce;
default is |
formant_dynamicRange |
Dynamic range in dB for producing formant plots.
When a formant plot of |
formant_color |
String or vector of strings giving the name(s) of
colors to be used for plotting formants. If one color is provided, all
formants will be plotted in this color. If multiple colors are provided,
different formants will be shown in different colors. Default is |
intensity_plotOnSpec |
Boolean; should intensity be plotted on top of
spectrogram? Default is |
it |
Intensity object loaded using rPraat::it.read or similar object. |
intensity_range |
Vector of two integers giving the intensity range to be
used for producing intensity plots. Default is |
intensity_axisLabel |
String giving the name of the label to print along
the y-axis when plotting intensity. Default is |
intensity_color |
String or vector of strings giving the name of the
color to be used for plotting intensity. Default is |
tgbool |
Logical; should dotted lines be plotted corresponding to
locations in a TextGrid? Default is |
lines |
Numeric vector giving locations in seconds of locations from
a TextGrid to be plotted with dotted lines. Default is |
focusTierColor |
String or vector of strings giving the color(s) to
use for plotting focus tier lines. If multiple tiers are focused, a vector
of the same length can be passed, and the nth tier will be plotted in the
nth color. Default is |
focusTierLineType |
String or vector of strings giving the line
type(s) for plotting focus tier lines. If multiple tiers are focused, a
vector of the same length can be passed, and the nth tier will be plotted in
the nth line type. Default is |
ind |
Integer indexing waveform relative to other plot components.
Default is |
min_max_only |
Logical; should only minimum and maximum values be given
on the y-axis? Default is |
axisLabel |
String giving the name of the label to print along the
y-axis when plotting a spectrogram. Default is |
Value
No return values, called internally by praatpicture and sibling functions.
Examples
# Don't use directly
datapath <- system.file('extdata', package='praatpicture')
soundFile <- paste0(datapath, '/1.wav')
praatpicture(soundFile, frames='spectrogram')