Loudline docs
v1.0.0
DemoDemo console Get help
● Use

How the measuring and processing works
the numbers, in plain words.

Loudline measures a recording, plans a louder copy, makes it, measures the copy again and tells the user what it found. This page explains each step so you can describe it correctly and trust the numbers.

BS.1770-4LUFStrue peakno FFmpeg

01The chain, in order

  1. Decode. The phone's own codec turns the picked file (or the audio of a video) into a temporary 16-bit WAV file.
  2. Measure. Dart code reads that WAV in blocks and finds the loudness (LUFS), the true peak and the noise floor.
  3. Process. The recording goes through noise reduction (if chosen), the tone preset (if chosen), a gain towards the loudness target and a look-ahead limiter at the peak ceiling.
  4. Measure again. The result is measured with the same meter. If the copy is not on the target, the gain is adjusted and the render repeated (up to four tries).
  5. Write. The copy is written as WAV. Only when the user shares it is it encoded to .m4a (AAC).

The work runs in a background task and in blocks, so a long recording does not need to fit in memory. Temporary files are removed when the user leaves the screen.

02Loudness (LUFS)

LUFS is the loudness standard used for podcasts, streaming and broadcast. Loudline implements the ITU-R BS.1770-4 method in app/lib/src/dsp/loudness.dart:

  • K-weighting: two filters (a high shelf and a high pass) make the meter react to sound the way hearing does. They are calculated for any sample rate.
  • 400 ms blocks with 75 percent overlap.
  • Absolute gate at -70 LUFS: blocks quieter than this are ignored, so silence does not pull the number down.
  • Relative gate at -10 LU: blocks more than 10 LU below the average of the remaining ones are ignored too. What is left gives the integrated loudness.
  • A mono file is measured as if played through both speakers (twice the energy of one channel).

The automated tests check the meter against reference values: a stereo 1 kHz sine at -23 dBFS reads -23.0 LUFS, and relative gating is checked on a known signal.

03True peak (dBTP)

A sample value can be below the limit while the smooth wave between two samples goes above it. The true-peak meter finds these in-between peaks by oversampling 4 times (a 49-tap windowed-sinc interpolator). The result is in dBTP. The peak ceiling in the app (-6 to 0 dBTP) is compared with this meter, not with the raw samples.

04Limiter

After the gain, a look-ahead peak limiter keeps the signal under the ceiling. It looks 5 ms ahead and releases over 80 ms, so it lowers the gain smoothly before a peak arrives instead of cutting it off. A test checks that no sample ends over the ceiling. The render also keeps a small margin under the ceiling (0.3 dB to start) and widens it if the measured true peak of the copy is still above the ceiling.

05Noise reduction

Noise reduction is spectral. The app finds the quietest stretches of the file (the quietest 15 percent of 100 ms blocks), learns the spectrum of the steady noise there, and subtracts it, frame by frame (1024-sample frames, 50 percent overlap). There are three levels:

LevelSubtraction strengthFloor
1 light1.0-6 dB
2 medium1.5-10 dB
3 strong2.0-15 dB

If the file has no pause or steady hiss to learn from (about half a second is needed), nothing is removed and the app says so. Noise reduction was tested with numbers (the noise floor falls and the loudness stays on target), not by ear: listen to your own samples.

06Tone presets

The tone presets use standard biquad filters (app/lib/src/dsp/eq.dart) and change colour, not the loudness target:

PresetFilters
FlatNone.
Voice clarityHigh pass at 80 Hz, a cut of 1.5 dB at 250 Hz, a lift of 2.5 dB at 3 kHz.
WarmHigh pass at 50 Hz, a low shelf of +2 dB at 180 Hz, a high shelf of -2 dB at 6 kHz.
BrightHigh pass at 60 Hz, a high shelf of +3 dB at 5 kHz.

07How the app judges the result

The app never gives a score. It measures the copy again and compares it with the plan:

  • The gain needed is the target minus the measured loudness (kept between -40 and +45 dB). The copy is accepted when it lands on the target within about 0.6 LU with the true peak under the ceiling; the automated tests check this on the whole render.
  • If the limiter cannot deliver the target at that ceiling, the copy is left where it landed and the app says the target was not reached.
  • If the original was already clipped in many places, or its peaks already touch the ceiling, the app says so.
  • If the signal is only a few dB above the noise (under 12 dB) and the copy is boosted, the app warns that the noise got louder too.
  • The noise floor is shown before and after, and a change of 3 dB or more is called out.

How much louder a copy gets therefore depends on the file. The app does not promise a fixed gain, and you should not either.

08Codecs and why there is no FFmpeg

All measuring and processing is Dart code written for this item. The only native code reads and writes compressed audio with the operating system's own codecs, through one method channel (com.mikodes.loudline/audio):

PlatformDecode to 16-bit WAVEncode to .m4a (AAC)File
AndroidMediaExtractor + MediaCodecMediaCodec AAC-LC + MediaMuxerandroid/app/src/main/kotlin/com/mikodes/loudline/AudioCodec.kt
iOSAVAssetReaderAVAssetWriterios/Runner/AudioBridge.swift

Why not FFmpeg: the packaged FFmpeg builds for Flutter are retired or ship under LGPL or GPL terms that would have to be kept replaceable and listed, and a GPL build cannot be sold on CodeCanyon. Using the phone's own codecs and our own measuring code means there is no third-party audio licence to carry or keep up to date.

Which file types open depends on what the phone's codecs can decode, so test the types your users have. Files that are mono or stereo work; more channels are reduced to the first two.

Never run on a device

The Kotlin and Swift codec bridges compile and are in the Android and iOS builds, but they have never run on a real device or simulator. Decoding and AAC encoding of real files is untested. First test on a device: an .m4a, an .mp3 and a video.