Skip to documentation
DocumentationAll documentsEnglish

DAMDF(1)

NAME

damdf - compute the average magnitude difference function of a stream of doubles

On this page

SYNOPSIS

damdf [window_size] < input.doubles > output.doubles

DESCRIPTION

damdf reads double-precision floating-point samples from standard input, computes the Average Magnitude Difference Function (AMDF) over successive windows, and writes the resulting doubles to standard output. The AMDF is an experimental measure used for pitch extraction: for each lag it accumulates the sum of absolute differences between a window and a lag-shifted copy of itself, then outputs 1024 minus that sum so that strong periodicities appear as peaks.

Input is processed in fixed blocks of window_size samples (default 512). A final partial block is zero-padded to a full window. Each block produces window_size output values. Because both streams are raw binary doubles, damdf refuses to run if either standard input or standard output is a terminal. It does not take any option flags; the only argument is the optional positional window_size.

EXAMPLES

Example 1. Estimate pitch periodicity of a sampled signal
damdf 1024 < signal.doubles > amdf.doubles
dpeak < amdf.doubles

Computes the AMDF of a stream of doubles over 1024-sample windows, then locates the dominant peaks with dpeak(1); the lag of the largest peak corresponds to the estimated pitch period.

SEE ALSO

brlcad(1), dauto(1), dfft(1), dpeak(1), dmod(1)

AUTHOR

BRL-CAD Team

This software is Copyright (c) 1989-2026 by the United States Government as represented by U.S. Army Research Laboratory.

BUG REPORTS

Reports of bugs or problems should be submitted via electronic mail to devs@brlcad.org