Home

Area of Interests

  • Digital Photogrammetry
  • Computer Visiion
  • Geoinformatics

Articles

Education

  • Ph.D. (RS&GIS) AIT
  • M.Sc. (RS&GIS) AIT
  • B.Sc. (Computer Science) RBRI

Classes

A Short Review of the DEMON Algorithm for Underwater Acoustic Analysis


Kumpee Teeravech
Geoinformatics Program (GI)
Faculty of Computer Science and Information Technology (CSIT)
Rambhai Barni Rajabhat University (RBRU)
2026-06-14
Several years ago, I had a chance to work with underwater acoustic analysis and was introduced to two classical techniques used in passive sonar processing: DEMON and LOFAR. At that time, I used these techniques for analyzing and classifying vessel sounds, including an implementation on STM32 microcontrollers (Teeravech, 2020).

In this article, I simply want to review the DEMON algorithm and capture some of my knowledge before it gradually disappears with time. The discussion is intentionally limited to the basic theory, processing algorithm, and small Python examples rather than modern machine-learning approaches.
Please note that all of the content in this article was automatically generated by AI

What Is DEMON?

DEMON, commonly expanded as Detection of Envelope Modulation on Noise, is a passive-sonar signal-processing technique used to reveal periodic modulation hidden inside broadband underwater noise generated by a vessel.

A moving vessel produces many acoustic sources, including:
  • propulsion machinery,
  • engines and generators,
  • gears and pumps,
  • propeller rotation,
  • propeller blades, and
  • cavitation around the propeller.
Among these sources, propeller cavitation is particularly useful for DEMON analysis. Cavitation produces relatively broadband noise, but its amplitude can be periodically modulated by the rotation of the propeller and the passage of individual blades.

Therefore, instead of looking only at the conventional spectrum of the received underwater signal, DEMON attempts to extract the low-frequency modulation contained in the envelope of broadband noise.

Basic Idea

Suppose the broadband propeller noise can be approximately represented as \[ x(t) = A(t)n(t) \] where:
  • \(n(t)\) represents broadband noise, such as cavitation noise, and
  • \(A(t)\) represents a slowly varying modulation related to the rotating propulsion system.
The conventional spectrum of \(x(t)\) may appear noisy because much of its energy is distributed over a relatively wide frequency range. DEMON attempts to recover the modulation \(A(t)\).

A simplified processing chain is: \[ \text{Audio} \rightarrow \text{Band-pass filter} \rightarrow \text{Envelope detection} \rightarrow \text{Downsampling} \rightarrow \text{FFT} \rightarrow \text{DEMON spectrum} \] This is essentially the processing sequence used in my previous vessel-sound study (Teeravech, 2020).

1. Band-Pass Filtering

The first step is to select a frequency region containing useful broadband noise: \[ x_{\mathrm{BPF}}(t) = \mathrm{BPF}\{x(t)\}. \] The purpose is not necessarily to directly find the shaft frequency. Instead, a higher-frequency region is selected where cavitation or other propeller-generated broadband energy is prominent.

In my previous implementation, the input audio was first resampled to \[ F_s = 8192\ \mathrm{Hz} \] and the DEMON band-pass filter was configured approximately as \[ 500 \le f \le 2500\ \mathrm{Hz}. \] These values were selected for that particular experiment and should not be considered universal DEMON parameters. Different vessels, hydrophones, environments, and sampling systems may require different frequency bands.

2. Envelope Detection

After filtering, the next important step is to obtain the signal envelope. One convenient digital method is the Hilbert transform.

For a real-valued signal \(x(t)\), its analytic representation is \[ z(t) = x(t) + j\hat{x}(t) \] where \(\hat{x}(t)\) is the Hilbert transform of \(x(t)\).

The signal envelope is then \[ e(t) = |z(t)| \] or equivalently \[ e(t) = \sqrt{x^2(t) + \hat{x}^2(t)}. \] Conceptually, this is the most important part of DEMON: we are not primarily interested in the broadband cavitation noise itself; we are interested in how its amplitude changes periodically with time.

3. Removing the DC Component

Because the envelope is non-negative, it normally contains a strong DC component. Before spectral analysis, it is useful to remove the mean: \[ e'(t) = e(t) - \bar{e}. \] Otherwise, the zero-frequency component can dominate the DEMON spectrum and make low-frequency features more difficult to inspect.

4. Downsampling

The original underwater recording may have a sampling frequency of several kilohertz or higher, while the modulation frequencies of interest are usually much lower. Therefore, after suitable filtering, the envelope can be downsampled.

In my previous STM32 implementation, the original sampling frequency was \(8192\ \mathrm{Hz}\) and a decimation factor of 32 was used: \[ F_{s,\mathrm{DEMON}} = \frac{8192}{32} = 256\ \mathrm{Hz}. \] The corresponding Nyquist frequency is \[ f_N = \frac{256}{2} = 128\ \mathrm{Hz}. \] This is sufficient for examining many low-frequency propeller-related modulation components while reducing the computational load.

5. FFT and the DEMON Spectrum

The final step is to transform the envelope signal into the frequency domain: \[ D(f) = \left|\mathcal{F}\{e'(t)\}\right|. \] The resulting spectrum is called the DEMON spectrum.

Unlike an ordinary acoustic spectrum, where a peak at 1 kHz means that strong acoustic energy exists around 1 kHz, a DEMON peak represents a modulation frequency.

For example, suppose the DEMON spectrum contains peaks at \[ 6,\ 12,\ 18,\ 24\ \mathrm{Hz}. \] These approximately harmonic peaks suggest the presence of a periodic propulsion-related mechanism. In my earlier experiment, a vessel with a four-blade propeller rotating at approximately \(360\ \mathrm{RPM}\) produced important DEMON components around 6, 12, and 24 Hz.

The shaft rotation frequency is \[ f_{\mathrm{shaft}} = \frac{\mathrm{RPM}}{60} = \frac{360}{60} = 6\ \mathrm{Hz}. \] For a propeller with \(N_b\) blades, the blade-passing frequency can be approximated as \[ f_{\mathrm{BPF}} = N_b f_{\mathrm{shaft}}. \] For four blades: \[ f_{\mathrm{BPF}} = 4(6) = 24\ \mathrm{Hz}. \] Thus, the 6 Hz and 24 Hz components can have physical interpretations related to shaft rotation and blade passage.

DEMON Waterfall or DEMONgram

A single FFT provides information for only one time interval. For continuous monitoring, the DEMON calculation can be repeated using consecutive or overlapping windows: \[ D_1(f),\ D_2(f),\ D_3(f),\ldots,D_N(f). \] Stacking these spectra produces a two-dimensional time-frequency representation: \[ D(t,f). \] This representation is often displayed as a waterfall or DEMON spectrogram. The horizontal axis represents modulation frequency, while the vertical axis represents time. Stable rotating machinery can produce persistent spectral lines.

In my previous work, DEMON and LOFAR spectra were accumulated into waterfall representations and later used as two input channels for vessel classification (Teeravech, 2020).

DEMON versus LOFAR

DEMON and LOFAR provide different but complementary descriptions of vessel sound.

A simplified LOFAR processing chain is: \[ \text{Audio} \rightarrow \text{Low-pass filter} \rightarrow \text{FFT}. \] A simplified DEMON processing chain is: \[ \text{Audio} \rightarrow \text{Band-pass filter} \rightarrow \text{Envelope} \rightarrow \text{FFT}. \] LOFAR examines ordinary acoustic-frequency content and may reveal machinery-related tonal components. DEMON examines amplitude modulation of broadband noise and is particularly useful for observing periodic characteristics related to shafts and propeller blades.

A Simple DEMON Algorithm

The basic DEMON algorithm can be summarized as:
  1. Acquire underwater audio from a hydrophone.
  2. Resample the signal if required.
  3. Select a suitable broadband-noise region using a band-pass filter.
  4. Calculate the analytic signal using the Hilbert transform.
  5. Calculate the magnitude of the analytic signal to obtain the envelope.
  6. Remove the DC component from the envelope.
  7. Low-pass filter and downsample the envelope.
  8. Apply a window function.
  9. Calculate the FFT.
  10. Examine peaks and harmonic structures in the DEMON spectrum.
  11. Repeat the calculation over time to generate a DEMON waterfall.

Dummy Python Implementation

The following code demonstrates the basic idea. It is intentionally simplified and should be considered demonstration code rather than a complete sonar-processing implementation.
import numpy as np
from scipy.signal import butter, sosfiltfilt, hilbert, resample_poly
from scipy.fft import rfft, rfftfreq


def demon(signal, fs):
    # 1. Select broadband region containing useful noise
    f_low = 500
    f_high = 2500

    sos = butter(
        4,
        [f_low, f_high],
        btype="bandpass",
        fs=fs,
        output="sos"
    )

    filtered = sosfiltfilt(sos, signal)

    # 2. Calculate signal envelope
    analytic = hilbert(filtered)
    envelope = np.abs(analytic)

    # 3. Remove DC component
    envelope -= np.mean(envelope)

    # 4. Downsample envelope
    fs_demon = 256

    envelope = resample_poly(
        envelope,
        fs_demon,
        fs
    )

    # 5. Apply window
    window = np.hanning(len(envelope))
    envelope = envelope * window

    # 6. FFT
    spectrum = np.abs(rfft(envelope))

    freq = rfftfreq(
        len(envelope),
        d=1.0 / fs_demon
    )

    return freq, spectrum

Simple Test

fs = 8192

# Dummy input signal
audio = np.random.randn(fs * 4)

freq, spectrum = demon(audio, fs)

for i in range(len(freq)):
    print(freq[i], spectrum[i])
A simple plot can be produced with:
import matplotlib.pyplot as plt

plt.plot(freq, spectrum)
plt.xlim(0, 128)

plt.xlabel("Modulation frequency (Hz)")
plt.ylabel("Magnitude")
plt.title("DEMON Spectrum")

plt.grid()
plt.show()

A Synthetic Propeller Example

To understand what DEMON is doing, consider a synthetic broadband signal whose amplitude is modulated at 6 Hz:
import numpy as np

fs = 8192
duration = 5

t = np.arange(
    0,
    duration,
    1.0 / fs
)

# Broadband noise
noise = np.random.randn(len(t))

# Simulated shaft modulation
shaft_frequency = 6

modulation = (
    1.0 +
    0.5 * np.sin(
        2 * np.pi * shaft_frequency * t
    )
)

# Simplified cavitation signal
signal = modulation * noise
The ordinary waveform mostly resembles noise. However, applying the DEMON algorithm should reveal a component near \[ 6\ \mathrm{Hz} \] because the amplitude of the broadband noise is varying six times per second.

Additional harmonic components can be added:
modulation = (
    1.0
    + 0.5 * np.sin(2 * np.pi * 6  * t)
    + 0.3 * np.sin(2 * np.pi * 12 * t)
    + 0.2 * np.sin(2 * np.pi * 24 * t)
)

signal = modulation * noise
The resulting DEMON spectrum should then contain peaks near 6, 12, and 24 Hz.

What DEMON Is Actually Telling Us

One of the easiest mistakes when first learning DEMON is to interpret it as another ordinary spectrogram. It is not.

If a normal spectrum contains a peak at 1000 Hz, we normally interpret it as significant acoustic energy around 1000 Hz.

If a DEMON spectrum contains a peak at 6 Hz, the interpretation is different: the amplitude of some broadband acoustic energy is being modulated periodically at approximately six cycles per second.

That periodic modulation may originate from shaft rotation, blade passage, cavitation, or another repetitive propulsion mechanism. This is why DEMON can reveal vessel characteristics that may be difficult to recognize directly from the ordinary acoustic spectrum.

Practical Limitations

Real underwater acoustic data are considerably more complicated than the synthetic example. The received signal may include:
  • multiple vessels,
  • environmental noise,
  • waves and rain,
  • biological sounds,
  • flow noise around the hydrophone,
  • reflections and multipath propagation,
  • changes in vessel speed,
  • different propeller configurations, and
  • changes in cavitation behavior.
Consequently, DEMON peaks do not automatically correspond to a particular shaft or blade without further interpretation. Filter selection is also important. If the selected acoustic band contains little propeller-modulated energy, envelope analysis may reveal little useful information.

DEMON is therefore best regarded as a feature-extraction technique rather than a complete vessel-identification algorithm.

Final Note

DEMON is conceptually simple: \[ \boxed{ \text{Select broadband noise} \rightarrow \text{extract its envelope} \rightarrow \text{analyze the envelope spectrum} } \] However, this simple procedure transforms apparently random underwater broadband noise into a representation where periodic mechanical characteristics of a vessel may become visible.

When I worked on this topic several years ago, I combined DEMON with LOFAR and later used their spectrograms as input to a small CNN running on STM32 microcontrollers. The experiment showed that classical sonar signal-processing techniques could be combined with embedded machine learning for real-time vessel-sound classification.

Today there are more sophisticated approaches to underwater acoustic recognition, but DEMON remains useful to understand because it provides a relatively direct connection between a feature in the signal and the physical rotating machinery that may have produced it.

References

Chung, K. W., Sutin, A., Sedunov, A., & Bruno, M. (2011). DEMON acoustic ship signature measurements in an urban harbor. Advances in Acoustics and Vibration, 2011, Article 952798. https://doi.org/10.1155/2011/952798

Moura, N. N., Filho, E. S., & Seixas, J. M. (2009). Independent component analysis for passive sonar signal processing.

Nielsen, R. O. (1991). Sonar signal processing. Artech House.

Teeravech, K. (2020). Classification of vessel sound using DEMON and LOFAR techniques on STM32 microcontroller. In Proceedings of the Sixteenth National Conference on Computing and Information Technology (NCCIT2020) (pp. 425-430).


The English in this article was prepared and revised with the assistance of ChatGPT.