| ENTspec | R Documentation |
Calculate the Temporal Entropy values of a single audio using the methodology proposed in Towsey, et al. 2014
ENTspec(
soundfile,
channel = "stereo",
timeBin = 60,
targetSampRate = NULL,
wl = 512,
window = signal::hamming(wl),
overlap = ceiling(length(window)/2)
)
soundfile |
wav package numeric matrix, tuneR package Wave object or path to a |
channel |
channel where the metric values will be extracted from. Available channels are: |
timeBin |
size (in seconds) of the time bin. Set to |
targetSampRate |
desired sample rate of the audios. This argument is only used to down sample the audio. If |
wl |
window length of the spectrogram. Defaults to |
window |
window used to smooth the spectrogram. Switch to |
overlap |
overlap between the spectrogram windows. Defaults to |
The Temporal Entropy (ENT) quantifies how concentrated or dispersed acoustic energy is over time within each frequency bin. Unlike indices that track frame-to-frame change (e.g. ACI), ENT treats the distribution of energy across an entire time bin as a probability mass function and measures its Shannon entropy, capturing whether energy is spread evenly through time (high entropy, low concentration) or concentrated into brief pulses (low entropy, high concentration).
In Ruido, ENT is computed independently within each time bin, using every time step of the spectrogram in that bin.
For a given frequency bin f, the squared amplitude values I_t across all time steps t within the time bin are normalized to unit area, producing a probability mass function:
pmf_{f,t} = \frac{I_t^2}{\sum_{t = 1}^{N} I_t^2}
where N is the number of time steps in the time bin. The Shannon entropy of this distribution is then calculated as:
H[f] = \frac{-\sum_{t = 1}^{N} pmf_{f,t} \times \log_2(pmf_{f,t})}{\log_2 N}
To express the result as an intuitive measure of energy concentration rather than dispersion, ENT is calculated as the complement of H:
ENT[f] = 1 - H[f]
The result is a frequency-resolved representation of ENT for each time bin, rather than a single scalar value for the entire recording. Values close to 1 indicate energy concentrated in few time steps (e.g. transient calls or pulses), while values close to 0 indicate energy spread evenly across the time bin (e.g. steady background noise).
This function returns a noise.matrix object.
Towsey, M., Wimmer, J., Williamson, I., & Roe, P. (2014). The use of acoustic indices to determine avian species richness in audio-recordings of the environment. Ecological Informatics, 21, 110–119. https://doi.org/10.1016/j.ecoinf.2013.11.007
ACIspec() to calculate the Acoustic Complexity Index and bgNoise() to calculate Background Noise and Soundscape Power.
### This is an example using audio from a real soundscape
### These audios are originated from the Escutadô Project, a project
### that records the soundscapes of the brazilian semiarid
# Getting audiofile from the online Zenodo library
dir = paste(tempdir(), "forExample", sep = "/")
dir.create(dir)
rec = paste0("GAL24576_20250401_", sprintf("%06d", 0), ".wav")
recDir = paste(dir, rec , sep = "/")
url = paste0("https://zenodo.org/records/17575795/files/",
rec,
"?download=1")
# Downloading the file, might take some time denpending on your internet
download.file(url, destfile = recDir, mode = "wb")
# Running the ENTspec function with all the default arguments
ent = ENTspec(recDir)
# Here's the result
ent
# Plot ENT values
plot(ent)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.