{
# load example data
data("test_sounds_est")
# add reference to X
X <- set_reference_sounds(X = test_sounds_est)
# get spetrum blur ratio
spectrum_blur_ratio(X = X)
# using method 2
X <- set_reference_sounds(X = test_sounds_est, method = 2)
spectrum_blur_ratio(X = X)
# get power spectra
sbr <- spectrum_blur_ratio(X = X, spectra = TRUE)
spctr <- attributes(sbr)$spectra
# make distance a factor for plotting
spctr$distance <- as.factor(spctr$distance)
# plot
rlang::check_installed("ggplot2")
library(ggplot2)
ggplot(spctr[spctr$freq > 0.3, ], aes(y = amp, x = freq,
col = distance)) +
geom_line() +
facet_wrap(~sound.id) +
scale_color_viridis_d(alpha = 0.7) +
labs(x = "Frequency (kHz)", y = "Amplitude (PMF)") +
coord_flip() +
theme_classic()
}
Run the code above in your browser using DataLab