maad.util.read_audacity_annot

maad.util.read_audacity_annot(audacity_filename)[source]

Read Audacity annotations file (or labeling file) and return a Pandas Dataframe with the bounding box and the label of each region of interest (ROI). Allows to read annotations with standard Audacity style (temporal selection) and with spectral selection style (spectro-temporal selection). If the file exists but has no annotations, the function returns and empty dataframe.

Parameters:
audacity_filenameString

Path to the audacity file

Returns:
tab_outPandas Dataframe

Region of interest with time-frequency limits and manual annotation label

References

https://manual.audacityteam.org/man/label_tracks.html

Examples

>>> from maad import sound
>>> from maad.util import power2dB, read_audacity_annot, format_features, overlay_rois
>>> s, fs = sound.load('../data/cold_forest_daylight.wav')
>>> Sxx_power, tn, fn, ext = sound.spectrogram(s, fs, nperseg=1024, noverlap=1024//2)
>>> Sxx_db = power2dB(Sxx_power) + 96
>>> df_rois = read_audacity_annot('../data/cold_forest_daylight_label.txt') 
>>> df_rois = format_features(df_rois, tn, fn)
>>> overlay_rois(Sxx_db, df_rois, **{'vmin':0,'vmax':96,'extent':ext})