maad.features.graphical_soundscape

maad.features.graphical_soundscape(data, threshold_abs, path_audio='path_audio', time='time', target_fs=48000, nperseg=256, noverlap=128, db_range=80, min_distance=1, n_jobs=1)[source]

Computes a graphical soundscape from a given DataFrame of audio files.

This function is a variant of the original graphical soundscapes introduced by Campos-Cerqueira et al. The peaks are detected on the spectrogram instead of detecting peaks on the spectrum. Results are similar but not equal to the ones computed using seewave in R.

References:
  • Campos‐Cerqueira, M., et al., 2020. How does FSC forest certification affect the acoustically active fauna in Madre de Dios, Peru? Remote Sensing in Ecology and Conservation 6, 274–285. https://doi.org/10.1002/rse2.120

  • Furumo, P.R., Aide, T.M., 2019. Using soundscapes to assess biodiversity in Neotropical oil palm landscapes. Landscape Ecology 34, 911–923.

  • Campos-Cerqueira, M., Aide, T.M., 2017. Changes in the acoustic structure and composition along a tropical elevational gradient. JEA 1, 1–1. https://doi.org/10.22261/JEA.PNCO7I

Parameters:
datapandas DataFrame

A Pandas DataFrame containing information about the audio files. If a string is passed with a directory location or a csv file, parameters ‘path_audio’ and ‘time’ will be set as default and can’t be customized.

threshold_absfloat

Minimum amplitude threshold for peak detection in decibels.

path_audiostr

Column name where the full path of audio is provided.

timestr

Column name where the time is provided as a string using the format ‘HHMMSS’.

target_fsint

The target sample rate to resample the audio signal if needed.

npersegint

Window length of each segment to compute the spectrogram.

noverlapint

Number of samples to overlap between segments to compute the spectrogram.

db_rangefloat

Dynamic range of the computed spectrogram.

min_distanceint

Minimum number of indices separating peaks.

n_jobsint

Number of processes to use for parallel computing. Default is 1.

Returns:
respandas DataFrame

A Pandas DataFrame containing the graphical representation of the soundscape.

Examples

>>> from maad.util import get_metadata_dir
>>> from maad.features import graphical_soundscape, plot_graph
>>> df = get_metadata_dir('../../data/indices')
>>> df['hour'] = df.date.dt.hour
>>> gs = graphical_soundscape(data=df, threshold_abs=-80, time='hour')
>>> plot_graph(gs)