This function is a wrapper around the meanspec function from the seewave package. It calculates
the mean spectrum of a wave object, flips the axes so that amplitude is on the x-axis and frequency
is on the y-axis, and fills the area under the curve with a black color.
Usage
mean_spectrum_flip(
wave,
freq.res = 50,
normalize = FALSE,
PSD = FALSE,
PMF = FALSE,
plot.title = "",
verbose = TRUE
)Arguments
- wave
A wave object from the
tuneRorseewavepackage, representing the audio signal to be analyzed.- freq.res
A numeric value representing the desired frequency resolution. This controls the window length (
wl) used in themeanspecfunction. Default is 50.- normalize
Logical. Should the spectrum be normalized (i.e., expressed in decibels)? Passed to the
normargument ofmeanspec. Default isFALSE.- PSD
Logical. If
TRUE, compute the power spectral density (PSD). Default isFALSE.- PMF
Logical. If
TRUE, compute the probability mass function (PMF) of the spectrum. Default isFALSE.- plot.title
A string for the plot's title. Default is an empty string (
"").- verbose
Logical. If
TRUE, print information about the window length and the number of frequency bins. Default isTRUE.
Value
The function returns a plot of the mean spectrum with flipped axes (amplitude on the x-axis and frequency on the y-axis) and the area under the curve filled with black.
Details
The function computes the mean spectrum using the meanspec function from the seewave package. It calculates the window length (wl) based on the provided frequency resolution, ensuring it is an even number. The function then plots the amplitude on the x-axis and the frequency on the y-axis, with a filled black area under the curve.
Examples
if (FALSE) { # \dontrun{
# Load example sound data
data(tico)
# Plot the mean spectrum with flipped axes
mean_spectrum_flip(tico, freq.res = 100, normalize = TRUE, plot.title = "Flipped Mean Spectrum")
} # }