DAMDF(1)

πŸ“¦ version 7.44.0, in nixpkgs unstable

πŸ’– DAMDF(1) πŸ’–

okay so real talk: this is the damdf page from the BRL-CAD manual set, and it's genuinely one of the most straightforward little tools ever. no flags, no drama, no ✨options section✨ β€” just vibes, doubles, and math. let's get into it 🫢


✨ NAME ✨

damdf β€” literally just computes the average magnitude difference function of a stream of doubles. that's it. that's the whole personality πŸŽ€


🌸 SYNOPSIS 🌸

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

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so bestie, here's the whole ~situation~:

damdf reads double-precision floating-point samples in from standard input, computes the Average Magnitude Difference Function (AMDF for short, iykyk) over successive windows, and writes the resulting doubles out to standard output. slay πŸ’…

so what even is an AMDF? it's an experimental measure used for pitch extraction πŸ”₯ and the way it works is genuinely kind of iconic: for each lag, it accumulates the sum of absolute differences between a window and a lag-shifted copy of itself, then it outputs 1024 minus that sum β€” so that strong periodicities show up as peaks. the math is mathing, periodt πŸ‘‘

input is processed in fixed blocks of window_size samples (and listen, the default is 512, no cap). a final partial block gets zero-padded to a full window, so nothing's ever left hanging πŸ™ˆ each block produces window_size output values.

now for the vibe check that actually matters: because both streams are raw binary doubles, damdf refuses to run if either standard input or standard output is a terminal. it's a hard no lol πŸ’€

and here's the thing β€” it does not take any option flags. at all. zero. the only argument is the optional positional window_size. that's the entire CLI. minimalist queen πŸ’œ


πŸŽ€ EXAMPLES πŸŽ€

Example 1. Estimate pitch periodicity of a sampled signal

damdf 1024 < signal.doubles > amdf.doubles
dpeak < amdf.doubles

so what's happening here: this 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. genuinely so satisfying when it works 🌈⭐


πŸ’« SEE ALSO πŸ’«

go read those next, bestie, they're all in the same friend group 🫢


πŸ‘‘ AUTHOR πŸ‘‘

BRL-CAD Team β€” icons only πŸ’–


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 β€” please don't suffer in silence, fr fr πŸ’€πŸ™ˆ


okay bestie that's the whole page!! this one ships out under the BRL-CAD banner (that's the source/version at the bottom of the original, BRL-CAD on the left and DAMDF(1) on the right, no date field to worry about!) β€” and that's a wrap πŸŒΈβœ¨πŸ’…

πŸ“¦ where this page comes from