rms_curve: Per-window RMS curve of an audio file

View source: R/rms.R

rms_curveR Documentation

Per-window RMS curve of an audio file

Description

Runs one ffmpeg astats pass over file and returns the RMS level of each fixed-size window. Quieter windows (more-negative dB) mark pauses, so the curve is a cheap way to find good places to cut. About 140x realtime.

Usage

rms_curve(file, window = 1024L)

Arguments

file

Path to an audio (or audio-bearing video) file.

window

Window size in samples (default 1024; ~64ms at 16kHz). Smaller windows give finer time resolution at more rows.

Value

A list with numeric time (window centre, seconds) and rms (RMS level in dB; digital silence is -120). Empty vectors if the pass ran but produced no metadata. Errors if ffmpeg itself fails.

Examples

## Not run: 
cur <- rms_curve("speech.mp3")
plot(cur$time, cur$rms, type = "l")   # dips are pauses

## End(Not run)

compost documentation built on Aug. 4, 2026, 5:11 p.m.