Converter tool

Bat Call Analyzer

Measure bat calls in full-spectrum recordings: duration, start, end and peak frequency, bandwidth and inter-pulse interval, with a spectrogram, time-expanded playback and a batch summary.

Input

Recordings

The WAV is read directly, so a 256 or 384 kHz recording is analysed at its own sample rate; nothing is resampled.

Bat Call Analyzer for Full-Spectrum Recordings

Operator: Abdulla Al Fahad. How tools are built and checked

A bat detector that records at 256 or 384 kHz keeps the whole call, and what a survey needs from it are a handful of measurements: how long the call lasts, where it starts and ends in frequency, where its energy peaks, how much bandwidth it sweeps, and how far apart the calls are. This page finds the calls in full-spectrum WAV files and measures each of them, shows the spectrogram with the calls outlined, plays any call back at a tenth or a twentieth of its speed, and summarises a night's files by hour and by call groups you define. It measures; it does not name species.

Key features

  • A WAV reader of its own that keeps the file's sample rate, from 192 to 500 kHz and beyond, and a time-expansion factor for files recorded with a time-expansion detector
  • Detection by band energy against a noise floor that follows the recording, with an adjustable margin, minimum and maximum call length and merge gap
  • Per call: start time, duration, start, end, maximum, minimum, peak and characteristic frequency, knee frequency when there is a clear one, bandwidth, slope, signal-to-noise ratio and the interval from the previous call
  • A spectrogram window with the detected calls outlined, click to select, and playback of the selected call slowed by 10 or 20
  • GUANO metadata read from the file and editable, with a copy of the WAV written back with the new fields
  • Batch summaries: calls per recording, files with no calls, calls per minute by hour of recording, and your own call types with their mean parameters

WAV files, GUANO metadata and what is measured

The WAV can be 8, 16, 24 or 32-bit PCM or 32 or 64-bit float, with one to eight channels; you choose the first or second. The data is read straight from the file, so nothing is resampled. A data chunk that is shorter than its header claims is accepted and flagged. Files up to 150 MB and 180 seconds of real time are read, one at a time, and a list of up to 500 files can be queued.

For a time-expanded recording, enter the factor. The sample rate in the header is multiplied by it to get the real rate, so the frequencies and times in the results are real ones. A ×10 file with a 44.1 kHz header is analysed as a 441 kHz recording.

GUANO is the open metadata format for bat recordings: a block of Key: value lines inside a guan chunk, starting with GUANO|Version. The page shows the fields, takes the hour from the Timestamp field when it has one, and otherwise from a file name such as 20240702_224105.wav.

How it works

Detection takes a short-time spectrum with a 256, 512 or 1024-point FFT, hopped by a quarter of its length, and sums the energy between the band limits you set. The noise level is the median of that energy over blocks of about a quarter of a second, interpolated between block centres, so a recording whose background changes still has a sensible threshold. Frames more than the margin above it, 10 dB by default, are joined across gaps shorter than the merge gap and kept if the length falls between your limits.

Each candidate is then measured in the time domain. The segment is band-passed with a zero-phase Butterworth filter and turned into its analytic signal. The duration is the time between the first and last points where the envelope is at least a tenth of its peak, that is within 20 dB. The start and end frequencies are medians of the instantaneous frequency over 0.1 ms at those edges, the peak frequency is the highest point of the zero-padded spectrum of the call with a parabola fitted through it, and the characteristic frequency is the median over the last quarter of the call.

Maximum and minimum frequency are the 98th and 2nd percentiles of the frequency track, and bandwidth is their difference. The knee is the point of largest change of slope between 15% and 85% of the call, reported only when the change stands out from the average slope. The interval between calls is the start-to-start time, given when the gap is no more than a second.

For playback the call and 20 ms either side are normalised and written to an audio buffer whose sample rate is the real rate divided by 10 or 20, which must fall between 8 and 96 kHz.

When this helps

  • A surveyor loads 240 five-second files from one night and sees that 61 contained no calls and are likely noise files, then uses the calls-per-minute table by hour to see that activity peaks in the hour after dusk.
  • A student raises the lower limit of the FM sweep range from 35 to 37 kHz and sees call 6 drop out into unassigned, because its peak of 36.6 kHz is above the 34 kHz top of the Low FM type and below 37 kHz.
  • A researcher with a ×10 time-expansion recording enters 10 and gets a call of 9 ms with a peak at 46 kHz instead of 90 ms at 4.6 kHz.
  • A volunteer wants to add a note to a file for the archive and writes Note: roost exit, east door into the GUANO box, then saves a copy of the WAV with the field.

Opening a file

  1. Drop the WAV files or load the example, and set the time-expansion factor if the files were recorded that way.
  2. Set the detection band to cover the calls you expect and leave the margin at 10 dB for a first pass.
  3. Optionally write call types, one per line, as name: 35-70 kHz, 3-7 ms.
  4. Press Analyse recordings and watch the file counter; Cancel stops it after the current file.
  5. Read the summary tables, then pick a recording and click calls in the spectrogram to see their parameters and hear them.

Example

The page's example: a computer-generated 4-second signal at 256 kHz with three descending sweeps, two constant-frequency calls and one hyperbolic sweep over noise

Band 15 to 110 kHz, FFT 512 (a bin of 0.5 kHz), margin 10 dB. Call types: FM sweep 35-70 kHz, 3-7 ms; CF call 40-52 kHz, 7-12 ms.

Six calls found

Call 1: 4.33 ms, start 76.5 kHz, end 43.6 kHz, peak 60.7 kHz, interval to call 2 80.0 ms
Call 4: 8.83 ms, start 46.1 kHz, end 46.3 kHz, peak 46.0 kHz, bandwidth 0.2 kHz, interval to call 5 100.0 ms
Call 6: 6.83 ms, 60.3 kHz down to 27.5 kHz, peak 36.6 kHz
Types: calls 1, 2, 3 and 6 are FM sweep, calls 4 and 5 are CF call

Tips for best results

  • Set the FFT size to 256 for short, steep calls and to 1024 for long, nearly constant ones; the bin width of 1.5 kHz at 384 kHz and 256 is much coarser than 0.4 kHz at 1024.
  • Lower the margin to 6 dB for faint distant calls, and raise the minimum length to 1 or 2 ms to keep insect and electrical clicks out.
  • Use the spectrogram window length of 0.1 s to see a single call's shape, and 1 or 2 s to see a pass.

Limits

The page does not identify species. Calls of different species overlap in every parameter it measures, one animal changes its calls with habitat, and species identification is regulated work in some countries that needs a trained identifier or validated software.

Echoes and reverberation lengthen a call because the envelope stays above a tenth of the peak, so durations from a recording in a tunnel or in a room are longer than the animal's call.

Duration at 20 dB below the peak is not the same as durations at 10 dB or by eye on a spectrogram. Compare values only with those made the same way.

A clipped recording, with samples at the 16-bit limit, spreads energy across all frequencies and distorts the frequency track near the loud part of the call.

Two calls less than the merge gap apart become one candidate. If its duration then exceeds the maximum length it is discarded, so very dense sequences may lose calls.

Common errors and how to fix them

The sample rate 96 kHz (after time expansion) is too low for a detection band up to 120 kHz.
Set the band limit below half the real sample rate, or enter the time-expansion factor if the file is time expanded.
The recording is 200 s long; this tool reads up to 180 s per file.
Split the recording into shorter files; the recorder usually has an option for that.
The file is 168 MB; files up to 150 MB are read.
Split the file. A 16-bit mono recording at 384 kHz reaches 150 MB after about 195 seconds, so the 180-second limit usually applies first.

Best practices

  • Keep the settings you used with the exported CSV; the XLSX export lists them on a sheet.
  • Spot-check a few calls in the spectrogram against the measured values before trusting a whole night's table.
  • Record GUANO fields such as the location and the detector at the time of recording, so the files describe themselves.

How close are the measurements?

The method was tried on computer-generated calls with known values at 384 kHz and a 512-point FFT, whose bin is 0.75 kHz. A linear sweep from 80 to 40 kHz in 5 ms, with 0.4 ms ramps at both ends, has a nominal 20 dB duration of 4.836 ms; the page measured 4.831 ms. Its start frequency read 78.71 kHz against 79.34 kHz and the end 41.11 kHz against 40.66 kHz, both within one bin. A 45 kHz constant-frequency call of 8 ms gave a peak of 45.000 kHz and a duration of 7.794 ms against a nominal 7.795 ms. A train of ten sweeps 85 ms apart gave an interval of 85.0003 ms, and noise alone gave no calls. Real recordings add reverberation, overlapping calls and varying noise, and the page was not compared with recordings of known species.

Frequently asked questions

Why does the example flag call 6 as an FM sweep when it is hyperbolic?

The call types are only ranges of peak frequency and duration. Call 6 peaks at 36.6 kHz and lasts 6.83 ms, which falls inside the FM sweep range of 35 to 70 kHz and 3 to 7 ms, so the first matching type takes it. Shape is not part of the rule.

Can I run a whole night of files without running out of memory?

Files are read and analysed one at a time and only their call lists are kept, so memory is set by the largest file. Reopening a file for the spectrogram reads it again.

How is the hour of recording chosen when a file has no GUANO metadata?

From a file name with a date and a time in the form YYYYMMDD_HHMMSS, as many detectors write. If neither is found the file is listed under an unknown hour.

Why does playback sometimes refuse to start?

The audio buffer rate is the real sample rate divided by 10 or 20, and browsers accept 8 to 96 kHz. A 1 MHz recording at ×10 would need 100 kHz, so choose ×20; a 96 kHz recording at ×20 would need 4.8 kHz, so choose ×10.