BlyxDocumentation
Browse chapters
Documentation / Workflow recipes

Warbler · Distinguish a clipped transient from a sustained overload

Flag sustained clipping while reporting the energy of an audio frame.

Distinguish a clipped transient from a sustained overload

Identical peak readings can represent a single transient or a sustained overload. Inspect run length alongside frame energy. Two adjacent full-scale samples breach the one-sample allowance. Separating them with silence changes the alert.

Run the framework with your own input

Install Blyx 0.2.1 and a Rust toolchain with a host linker, then run the versioned project. Each positional argument is a number or a comma-separated numerical vector. The CLI accepts up to 16 entries per vector. The imported module accepts longer inputs.

git clone --depth 1 --branch v0.1.1 https://github.com/Rahulchaube1/blyx-warbler.git
cd blyx-warbler
blyxc native-run project.blyx -- "1,-1,0,0" 1 1

API and return values

Returns [peak, mean square, longest clipped run, alert]. Alert means the longest run exceeded the allowed number of samples. Invalid input returns an empty vector.

ArgumentAccepted input
samplesVector of: finite number
ceilingpositive finite number
allowednonnegative exact integer

Use the libraries independently

The framework vendors the same library source published in these two repositories. Each module has its own package page, input contract and regression suite.

Try the program

Output Ready
Expected output
1
0.5
2
1
Open in the full playground →

Practice

Change samples = [1, 0, -1, 0]. Predict the result, then run the program.

Hint

Returns [peak, mean square, longest clipped run, alert]. Alert means the longest run exceeded the allowed number of samples.

Worked solution

The result vector is [1, 0.5, 1, 0]. Compare its fields with the return layout in the API section.

Find

    let samples = [1, -1, 0, 0];

Replace with

    let samples = [1, 0, -1, 0];

Output after the change

1
0.5
1
0