Phone recordings reached my audio model 20 dB quieter than its YouTube training data, and its answers moved with the gain

My sound classifier was trained on YouTube audio. The first real recordings from users’ phones came in about 20 dB quieter, and the model’s answers changed when I changed nothing but the volume. A pre-filter that checked « is this a vehicle? » also called most of the phone audio music.

TL;DR — YouTube audio is loudness-normalised (median −19 dBFS RMS in my data), while a phone mic with its automatic gain turned off records at −44 to −35 dBFS, close to its own noise floor. Bring the model input to the training level on the device, simulate the phone mic chain at training time, and don’t run an AudioSet « is it a vehicle? » filter on user recordings.

The setup

An Android app that diagnoses car sounds. The user puts the phone near the engine and records 10 seconds. The app cuts the recording into 5-second windows, and a small model trained on YouTube clips of engines scores each window: a list of possible faults plus a few attributes of the engine (fuel type, number of cylinders, turbo or not). Before training, a cleaning step runs a general-purpose AudioSet tagger (a pretrained model that labels any audio with classes like « Vehicle », « Engine », « Music », « Speech »). Windows where vehicle, engine and car all score below 0.2 are thrown out as « music or other ». The app turns off the phone’s automatic gain control (AGC) and noise suppression, so it records close to raw microphone audio, and it refuses recordings quieter than −50 dBFS. Users can share their recordings, which then go through the same cleaning step to become training data.

dBFS is decibels relative to digital full scale: 0 is the loudest possible sample, and every −6 dB halves the amplitude.

What I expected

An idling engine has the same harmonics whoever records it, and a model on log-mel spectrograms should care about the shape of the spectrum more than its height. Training already applied a random ±6 dB gain, which I assumed covered loudness.

What actually happens

I measured the first three real phone recordings (one owner, engines idling) against 48 training windows picked at random, one per video.

RMS level in dBFS: 48 YouTube training windows spread from -29.5 (p10) to -11.0 (p90) with a median of -18.6; the three phone recordings sit at -44.4, -36.4 and -34.7; the phone noise floor is -47.6 to -45.3; the app refuses anything under -50 and now feeds the model at -19.

  • Level. The phones sat 15 to 26 dB below the training median. The quietest recording’s engine was only 1 dB above the phone’s noise floor.
  • Spectrum. One recording lost about 20 dB above 1 kHz: a muffled phone (thick case, face down, or too far). The other two stayed inside the training range.
  • The AudioSet filter. 4 or 5 of the 6 phone windows scored under 0.2 on vehicle, engine and car, so the cleaning step would have thrown them out as « music or other ». For comparison, the median « vehicle » score of the training windows was 0.31.
  • The model. It said « turbo » at 0.93 to 0.97 on engines without a turbo. Its fuel-type probability for the same sound moved from 0.10 to 0.97 depending only on the gain applied before inference.

A model whose fuel-type answer follows the volume has learned loudness as a feature. The ±6 dB gain never reached 20 dB below YouTube’s level.

The fix

1. Normalise the model input on the device. One gain per recording brings the audio to −19 dBFS RMS, the training median. The gain is clamped to −12 / +26 dB and rare peaks are clipped. The quality check, the history and the upload keep the raw sound.

2. Simulate the phone at training time. On a training window, with some probability: set a random raw phone level (−50 to −15 dBFS), add a pink/white noise floor at −48 to −42 dBFS, sometimes a low-pass at 1–4 kHz (muffled phone) or a high-pass at 40–120 Hz (phones that cut the bass), sometimes a slow compressor (an AGC that was not turned off), sometimes 1 to 4 short knocks, then the app’s own normalisation. Validation and test windows stay clean. A reduced version you can run:

import numpy as np

SR = 32000
rng = np.random.default_rng(0)

def rms_db(x): return 20 * np.log10(np.sqrt(np.mean(x ** 2)))
def set_level(x, db): return x * 10 ** ((db - rms_db(x)) / 20)

def lowpass(x, fc):  # 2nd-order Butterworth magnitude, zero phase
    f = np.fft.rfftfreq(len(x), 1 / SR)
    return np.fft.irfft(np.fft.rfft(x) / np.sqrt(1 + (f / fc) ** 4), n=len(x))

def app_normalise(x, target=-19.0, lo=-12.0, hi=26.0):  # same rule as the app
    return np.clip(x * 10 ** (np.clip(target - rms_db(x), lo, hi) / 20), -1, 1)

def phone_chain(x):
    raw = rng.uniform(-50, -15)                        # raw phone level
    x = set_level(x, raw)
    if rng.random() < 0.5:                             # phone noise floor
        x = x + set_level(rng.standard_normal(len(x)), rng.uniform(-48, -42))
    if rng.random() < 0.3:                             # muffled: case, pocket
        x = lowpass(x, rng.uniform(1000, 4000))
    return raw, app_normalise(x)

t = np.arange(5 * SR) / SR
engine = np.sin(2 * np.pi * 25 * t) + 0.5 * np.sin(2 * np.pi * 50 * t) + 0.1 * rng.standard_normal(len(t))
for _ in range(5):
    raw, y = phone_chain(set_level(engine, -19))
    print(f"phone {raw:6.1f} dBFS -> model input {rms_db(y):6.1f} dBFS")
phone  -38.4 dBFS -> model input  -19.0 dBFS
phone  -49.5 dBFS -> model input  -23.6 dBFS
phone  -25.3 dBFS -> model input  -19.0 dBFS
phone  -37.5 dBFS -> model input  -19.0 dBFS
phone  -43.3 dBFS -> model input  -19.0 dBFS

The second line is the +26 dB clamp at work: a very quiet phone still reaches the model a little under the target, as in the app.

3. Don’t apply the vehicle-score filter to user uploads. Recordings coming from the app are still rejected for silence, clipping and speech, but never for a low AudioSet « vehicle » score. YouTube clips keep every rule.

Why it works

YouTube normalises loudness, so most training clips land within ±10 dB of one level. A phone near an engine with AGC off has no such step. To the model, a quiet engine is a different picture: the same harmonics sitting lower, next to a noise floor it never saw.

Normalising the input moves the phone audio back into the range the model knows. On the measured windows, bringing the same sound to −19 dBFS improved the fuel-type answer on every window where the right answer was known. The augmentation covers what normalisation cannot undo: the noise floor boosted along with the engine, the missing highs, the knocks. Training and app end with the same normalisation.

The AudioSet tagger learned « vehicle » from video soundtracks too. Using it to gate the very recordings collected to close the gap filters out the gap.

What I did not test

  • The accuracy gain from the augmentation has not been measured. The chain is implemented and unit-tested (8 tests: output level, gain clamp, filters, noise level, knocks, compressor, val/test never augmented), but it is off by default and no model trained with it has been evaluated yet. The plan is to compare on the frozen test split and on a small set of real phone recordings.
  • Three recordings from one owner, all at idle. The −19 dBFS target, the noise floor and the filter ranges come from very little data.
  • The turbo error is not fixed. Normalising the level did not move it (0.95 to 1.0 after normalisation), so it is not a loudness problem. Whether the phone augmentation helps is untested. Earlier, 235 targeted photos beat longer training on a vision model. Real phone recordings may be the actual cure here too.
  • Bass-cutting phones were not observed; the high-pass step anticipates them.

Facts

context: Audio classifier trained on loudness-normalised YouTube clips, deployed in an Android app recording with AGC off
problem: Phone recordings arrived at -44 to -35 dBFS RMS vs a -19 dBFS training median; model outputs moved with gain alone; AudioSet vehicle filter tagged 4-5 of 6 phone windows as music/other
solution: Normalise model input to the training median (-19 dBFS, gain clamped -12..+26 dB); phone-mic augmentation chain (level, noise floor, low/high-pass, slow compressor, knocks, then the same normalisation); no AudioSet vehicle filter on user uploads
verified_on: 2026-10-28
applies_to: Audio models trained on web video soundtracks and run on raw phone microphone input
does_not_apply_to: Accuracy gain of the augmentation (not measured yet); phones recording with AGC on; the turbo over-prediction (not level-related)

Laisser un commentaire

Votre adresse e-mail ne sera pas publiée. Les champs obligatoires sont indiqués avec *

Retour en haut