'Does anyone know how to plot long term spectral averages (LTSA) and PSD in R?
I'm trying to make some plots to document the soundscape of a large dataset of .wav files Essentially, I have a series of consecutive 10-min 24-bit files for about 6 months so visualisation is very important here...
I have looked into the lts function of seewave, but can't get around the time format. The function expects either songmeter or audiomoth recorders and doesn't list the specific format it requires. Other functions for spectrograms become unsuccessful when I run in batches because R will block.
Another source for both LTSAs and PSD that I've looked at is PAMGuide, but the heaviness of this dataset makes it extremely difficult to achieve anything...even monthly plots will fail.
I wonder if anyone around here has either tried to work around seewave::lts or have used other functions to get similar analyses done directly through the raw .wav data? I don't seem to find much in R in terms of doing analyses on multiple files and plotting soundscapes.
Any help would be much appreciated!
Solution 1:[1]
PAMGuard (www.pamguard.org) has an LTSA module and will handle processing very large datasets and a variety of different types of file time stamps. Instructions for processing an LTSA in PAMGuard are here - after processing you can view the LTSA in PAMGuard viewer mode with data stored and saved in bespoke "PAMBinary" files. For paper/report quality images it is possible to export and plot an LTSA in MATLAB using the PAMGuard datagram library. You could transcribe this library in R using the PAMBinaries library to open the PAMBinary files.
Here's some example MATLAB code to plot an LTSA using the datagram library.
%% load an LTSA and plot
%path to pamguard binary storage folder
pamguardbinaryfolder ='/Volumes/Path/To/PAMGuard/BinaryFiles/';
detindex = 4; %LTSA
hsens = -175; % dB re 1V/uPa hydrophone sensitivity
gain =0; % additonal gain
vp2p = 2; %V Daq card peak to peak voltage range
sR = 384000; % sample rate.
% calculate a datagram
[datagram, summarydat, metadata] = loaddatagram(pamguardbinaryfolder, detindex, ...
'TimeBin', 10, 'Gain', gain, 'HSens', hsens, 'vp2p', 2);
% plot the datagram
metadata.sR = sR;
[s, c] = plotdatagram(datagram, metadata);
datetick('KeepLimits', 'x')
set(gca, 'FontSize', 14)
which should give you an image something like
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 |