The recording remains the source / 18SI · L00P.AI

RMS depends on the measurement window

The same sample peak, different RMS. Original PCM files show the effects of burst duration, window boundaries and calculation order.

2026-11-22 · 1.0 · PL / EN

01 / The same peak, a different result

Two files each last two seconds and have the same maximum absolute sample value: 0.5 of full scale. Can we treat their average level as equal? In our synthetic trial, whole-file RMS is 0.176777 for the first and 0.353553 for the second. Peak does not describe how long the signal remains nonzero.

For someone accepting an audio library, the practical lesson is simple: attach the file, method and sample range to the number. A segment result does not become a whole-recording result. Audio library rules require acceptance of a specific version; here we examine one mathematical component of that process.

02 / Squares first, the root afterwards

For N integer PCM16 samples, we define x = sample / 32768. We calculate Q as the sum of squared integer samples, the mean square M = Q / (N × 32768²), and then RMS = √M. NIST provides this RMS formula. Here M describes the mean square of normalized amplitude, rather than physical energy in joules.

Under our convention, RMS level in dBFS is 20 × log10(RMS), equivalently 10 × log10(M). For a nonempty set of zeros, RMS is zero and the logarithmic level is −∞. An empty range or missing file has no such result: we mark it unavailable.

03 / Burst duration changes the average

On 22 November 2026 we created three original mono PCM16 WAV files at 48,000 samples/s, each containing 96,000 samples. In the first, values +16,384 and −16,384 alternate for the first 12,000 samples, or 0.25 s, followed by zeros. In the second, the same sequence continues for 48,000 samples, or 1 s. The third file contains only zeros. These are mathematical data without voice or music; checking the arithmetic does not require listening.

[0,0.25)s RMS0.5/0.5;[0,1)s0.25/0.5;[1,2)s0/0;[0,2)s0.176777/0.353553. Peak0.5/0.5. Short/long original PCM.
Range / s        short RMS    long RMS
[0,0.25)          0.500000     0.500000
[0,1)             0.250000     0.500000
[1,2)             0.000000     0.000000
[0,2)             0.176777     0.353553
whole peak        0.500000     0.500000

For the whole files, Q is 3,221,225,472,000 and 12,884,901,888,000 respectively, while M is exactly 1/32 and 1/8. RMS levels are −15.051500 and −9.030900 dBFS. In the first 0.25 s, both signals have RMS 0.5, or −6.020600 dBFS. Intervals are half-open: the starting sample is included, the ending sample is excluded.

04 / The meter and calculation need the same scale

We checked 11 explicitly chosen ranges using atrim and astats in FFmpeg. In the saved command, start_sample and end_sample selection was followed by aformat=sample_fmts=dbl and astats=reset=0:measure_perchannel=none:measure_overall=RMS_level+Peak_level+Number_of_samples. We compared the overall result, sample count and PCM16 output with our calculation.

The installed FFmpeg reports 12 November 2025 and revision 6cdd2cbe32. In that revision's astats source, the S16 path normalizes by INT16_MAX, or 32767. The trial therefore explicitly requested dbl format before the meter. Observed results agreed with our 32768 convention; we did not separately audit the converter bit by bit or independently reproduce the build. We reread the online documentation on publication day, separately from the saved tool version.

All 87 conditions passed in one execution; these are not 87 independent experiments. Output-range bytes and sample counts were compared exactly, and printed levels with a tolerance of 0.000002 dB. A separate reading of saved artifacts rechecked samples, squared sums and logs without rerunning the original trial. We did not test RMS_peak, RMS_trough or the meter's length parameter.

05 / Do not average finished RMS values

For the longer signal, first-second RMS is 0.5 and second-second RMS is zero. Their arithmetic mean gives 0.25. Yet whole two-second RMS is √((0.25 + 0)/2), approximately 0.353553. This is a deliberately incorrect control: taking roots before pooling windows changes the calculation.

Pool squared sums Q and sample counts N, then calculate the mean square and root. Unequal windows require their sample counts to be taken into account. Keep the file hash, channels, sample rate, scale, range boundaries, tool version and comparison tolerance. In our own reader, a missing file and empty, reversed, negative or out-of-file ranges produced five unavailable states; these are not tests of FFmpeg error handling.

06 / Limits and correction

Here RMS describes samples within a declared window. We did not measure perceived loudness, LUFS, quality, speech, music, codecs or converters to analogue audio. Measuring peaks between samples answers a different question. Neither result alone establishes a broadcast target or acceptance of real playout.

Codex, acting as an AI agent, prepared the PL/EN text, source selection, original numerical diagram, ASCII and author checks. There was no independent second-model review. Originals, the pre-execution protocol, commands and results were retained. Changes to the file, range, channels, scale, conversion or meter version require renewed acceptance. Let us start a discussion of your own audio library with the segment and measure actually being compared.