This function was slightly changed from phonTools::spectrogram()
.
Argument description is copied from phonTools::spectrogram()
.
draw_spectrogram(
sound,
fs = 22050,
text_size = 1,
window_length = 5,
dynamic_range = 50,
window = "kaiser",
windowparameter = -1,
freq_scale = "kHz",
spectrum_info = TRUE,
timestep = -1000,
padding = 10,
preemphasisf = 50,
frequency_range = c(0, 5),
nlevels = dynamic_range,
x_axis = TRUE,
title = NULL,
raven_annotation = NULL,
formant_df = NULL
)
Either a numeric vector representing a sequence of samples taken from a sound wave or a sound object created with the loadsound() or makesound() functions.
The sampling frequency in Hz. If a sound object is passed this does not need to be specified.
numeric, text size (default = 1).
The desired analysis window length in milliseconds.
Values greater than this many dB below the maximum will be displayed in the same color.
A string indicating the type of window desired. Supported types are: rectangular, hann, hamming, cosine, bartlett, gaussian, and kaiser.
The parameter necessary to generate the window, if appropriate. At the moment, the only windows that require parameters are the Kaiser and Gaussian windows. By default, these are set to 2 for kaiser and 0.4 for gaussian windows.
a string indicating the type of frequency scale. Supported types are: "Hz" and "kHz".
logical. If TRUE
then add information about
window method and params.
If a negative value is given, -N, then N equally-spaced time steps are calculated. If a positive number is given, this is the spacing between adjacent analyses, in milliseconds.
The amount of zero padding for each window, measured in units of window length. For example, if the window is 50 points, and padding = 10, 500 zeros will be appended to each window.
Preemphasis of 6 dB per octave is added to frequencies above the specified frequency. For no preemphasis, set to a frequency higher than the sampling frequency.
vector with the range of frequencies to be displayed
for the spectrogram up to a maximum of fs
/2. This is set to 0-5 kHz by
default.
The number of divisions to be used for the z-axis of the spectrogram. By default it is set equal to the dynamic range, meaning that a single color represents 1 dB on the z-axis.
If TRUE
then draw x axis.
Character with the title.
Raven (Center for Conservation Bioacoustics) style
annotations (boxes over spectrogram). The dataframe that contains
time_start
, time_end
, freq_low
and freq_high
columns. Optional columns are colors
and content
.
dataframe with formants from formant_to_df()
function
# NOT RUN {
draw_spectrogram(system.file("extdata", "test.wav",
package = "phonfieldwork"
))
# }
# NOT RUN {
# }
Run the code above in your browser using DataCamp Workspace