bsnr
Bioacoustic SNR Estimation Toolbox for MATLAB

bsnr estimates signal-to-noise ratio for bioacoustic detections from hydrophone recordings. It is designed for tonal and frequency-modulated calls — whale song, upcalls, clicks — against broadband ocean noise.

Seven SNR methods span bioacoustic, speech, and engineering approaches. All methods support calibrated acoustic levels (dB re 1 µPa), click removal, and batch processing with optional parallel execution.

bsnr was developed at the Australian Antarctic Division to support reproducible SNR reporting in published cetacean acoustics research.

Features

  • Seven SNR methods
  • Annotation trimming
  • Three display types
  • Calibrated dB re 1 µPa
  • Click removal
  • Batch + parallel
  • Published-data examples
  • Comprehensive tests

Design philosophy

Correct

Verified against known results

Analytical tests verify known SNR values. Includes comparison with and predominantly faithful reproduction of published SNR estimates.

Clear

Well documented

Explicit parameter names with tab-completion. Diagnostic plots show exactly what was measured. resolvedParams helps record which parameters were actually used.

Consistent

Aspiring to shared standards

Shared conventions across functions make it easier to learn one part and apply that knowledge elsewhere. Where possible, outputs align with Tethys and ASA passive acoustic metadata standards.

Quick start

% Add bsnr and dependencies to path
addpath('C:\analysis\bsnr', '-begin');
% Load a bundled Z-call clip (included in examples/audio/)
audioDir = fullfile(fileparts(which('bsnr')), 'examples', 'audio', 'abw_z');
sf = wavFolderInfo(audioDir, '', false, false);
annot.soundFolder = audioDir; annot.t0 = sf(1).startDate + 17/86400;
annot.tEnd = annot.t0 + 21/86400; annot.duration = 21; annot.freq = [17 28];
annot.channel = 1; annot.classification = 'ABW Z';
% Name-value syntax with tab-completion
snr = snrEstimate(annot, 'snrType', 'spectrogramSlices');
fprintf('SNR = %.1f dB\n', snr);

Documentation

→
Start here

Getting Started

Installation, your first SNR estimate, building annotation structs, choosing a method, batch processing, calibration, and troubleshooting.

getting_started.md
→
Method gallery

SNR Methods & Display Types

All seven methods illustrated on synthetic and real Antarctic baleen whale recordings, with spectrogram, time series, and histogram displays. Covers calibrated levels, click removal, and STFT parameter guidance.

bsnr_gallery.m
→
Development story

Development Journey

How bsnr came to be, what worked and what didn't, and an honest account of co-developing research software with an AI assistant over many sessions.

journey.md
→
For contributors

Architecture

Codebase structure, call chain, annotation format, and the key design decisions that shaped the tool — including what was tried and rejected.

architecture.md

Published-data examples

→
Miller et al. (2022)

Antarctic Blue Whale D-calls — Casey 2019

SNR for 1319 analyst true-positive D-call detections using the merged signal window (max of analyst and detector duration). A systematic parameter search found r = 0.48 vs paper snrLurton — the original values could not be reproduced exactly from the published supplemental material.

snr_dcalls_casey2019.m
→
Miller et al. (2021)

ABW A/B/Z Calls — IWC-SORP Annotated Library

ABZ call SNR across 8 sites from the open-access IWC-SORP Annotated Library. CDF distributions per site replicate Figure 8 of the paper, with r = 0.61–0.82 vs original values.

snr_abw_sorp_library.m
→
Castro et al. (2024)

Seasonal SNR & Noise Level — Kerguelen 2014

Calibrated seasonal SNR and noise level distributions replicating Figure 5. Demonstrates the spectrogramSlices method with acoustic calibration; noise levels match within 0.5 dB after bandwidth correction.

snr_abw_kerguelen2014_castro2024.m
→
Miller et al. (in press)

Parallel Processing Guide — Common Ground ABZ Calls

How to characterise a 50k-annotation workload, measure parpool startup overhead, identify the CPU vs I/O bottleneck, and choose parallel settings. Worker sweep shows 7.7× speedup at 30 workers on Casey 2019.

snr_parallel_guide_casey2019.m
→
Miller et al. (in press)

Antarctic Blue Whale ABZ Calls — Common Ground

Per-observer SNR for 1289 adjudicated detections from five observers (three analysts, two automated detectors). bsnr gives r = 0.96 vs paper values — a close match given bsnr uses a fixed batch nfft where the original used per-annotation nfft.

snr_abw_casey2019_commonground.m
Dependencies

Required toolboxes

MATLAB R2021b+, Signal Processing Toolbox, soundFolder, annotatedLibrary.