lts {seewave}R Documentation

Long-term spectrogram

Description

A spectrogram computed over several survey files obtained with a Wildlife Acoustics SongMeter recorder

Usage

lts(dir, f, wl = 512,
wn = "hanning", ovlp = 0, rmoffset = TRUE, FUN = mean, col = spectro.colors(30),
fftw = FALSE, norm = FALSE, verbose = TRUE,
tlab = "Time", ntann = NULL, flab = "Frequency (kHz)",
recorder = c("songmeter", "audiomoth"), plot = TRUE, ...)

Arguments

dir

a character vector, the path to the directory where the .wav files are stored or directly the names of the .wav files to be processed.

f

sampling frequency of wave (in Hz). Does not need to be specified if embedded in the .wav files contained in dir.

wl

window length for the analysis (even number of points) (by default = 512).

wn

window name, see ftwindow (by default "hanning").

ovlp

overlap between two successive windows (in %).

rmoffset

a logical to sepcify whether DC offset should be removed. By default TRUE.

FUN

the function to apply to compute the successive frequency spectra, by default mean for a mean spectrum but could be other as median or var for a median spectrum or variance spectrum.

col

a list of colors or the color palette with a number of colors

fftw

if TRUE calls the function FFT of the library fftw. See Notes.

norm

a logical, to specify if each mean spectrum should be normalised between 0 and 1 (default FALSE) before to concatenate the image.

verbose

a logical, if TRUE (default) the file number and name processed are displayed in the console.

tlab

label of the time axis.

ntann

a numeric of length 1, the number of axis annotations (all annotations by default).

flab

label of the frequency axis.

recorder

the type of automatic recorder used, either a Wildlife SongMeter or a Open Audio deveices Audiomoth.

plot

logical, if TRUE plots the spectrogram (by default TRUE).

...

other image graphical parameters.

Details

The function reads each .wav file and computes its mean spectrum with meanspec. The successive mean spectra are then concatenated into a single image with the function image. The parameters wl, ovlp, and wn are those of the function meanspec.

Value

This function returns a list of three items:

time

a numeric vector corresponding to the time axis.

freq

a numeric vector corresponding to the frequency axis.

amp

a numeric or a complex matrix corresponding to the amplitude values. Each column is a Fourier transform of length wl/2.

Author(s)

Jerome Sueur

See Also

spectro, meanspec, image, spectro3D, ggspectro, songmeter, audiomoth

Examples

## Not run: 
## if 'dir' contains a set of files recorded with a Wildlife Acoustics
# songmeter recorder then a direct way to obtain
# the spectrogram of all .wav files is
dir <- "pathway-to-directory-containing-wav-files"
lts(dir)
# to normalise each mean spectrum
lts(dir, norm=TRUE)
# to change the STFT parameters used to obtain each mean spectrum
lts(dir, wl=1024, wn="hamming", ovlp=50)
# to change the colors and the number of time labels and to make it quiet
lts(dir, col=cm.colors(20), ntann=10, verbose=FALSE)
## direct use of files names stored in the working directory
files <- c("S4A09154_20190213_150000.wav", "S4A09154_20190213_153000.wav",
"S4A09154_20190213_160000.wav", "S4A09154_20190213_163000.wav",
"S4A09154_20190213_170000.wav", "S4A09154_20190213_173000.wav",
"S4A09154_20190213_180000.wav", "S4A09154_20190213_183000.wav",
"S4A09154_20190213_190000.wav", "S4A09154_20190213_193000.wav")
lts(files)

## End(Not run)

[Package seewave version 2.2.3 Index]