matchering developer on retainer: overly bright masters with quiet dynamic references — silence sections inflate reference HF spectrum 3.1 dB — noise-floor gate removes silence before matchering.process() — 3 weeks — matchering developer on monthly retainer
matchering (sergree/matchering) 2.0.6 • Python 3.9; automated audio mastering library; matchering.process(target_path, reference_path, [result_path]) computes spectral transfer function by averaging STFT magnitude spectrum over all frames in both target and reference audio files, then applies smoothed EQ transfer function and RMS loudness matching to produce the mastered result • automated audio mastering service (500 tracks/month: indie rock, singer-songwriter, acoustic jazz, chamber ensemble recordings; each track paired with a client-supplied reference master; 25% of references are quiet/dynamic recordings at −18 to −20 LUFS-I with dynamic range DR > 12 and 30–50% silence fraction); matchering averages STFT magnitude over all reference frames including near-silent sections; silence sections at −70 to −80 dBFS contain recording noise floor (HVAC, equipment self-noise, dither) with a slight HF tilt at 8–16 kHz; for a reference with 40% silence, noise floor frames inflate the averaged reference HF spectrum by +3.1 dB at 8–16 kHz vs the musical content alone; matchering EQ transfer function applies this inflation to the target; master sounds 3.1 dB too bright at 8–16 kHz vs the reference perceptual character; 25% of tracks mastered against quiet/dynamic references scored “too bright/harsh compared to reference” by blind listener panel (N = 40); client revision request rate 25% vs industry benchmark <3% • developer investigates matchering spectral averaging behavior on quiet/dynamic references, noise floor spectral contribution to HF transfer function, and reference pre-processing to remove silence contamination for 3 weeks • root cause: matchering.process() averages STFT over entire reference file; near-silence frames (30–50% of file for dynamic recordings) contribute noise floor HF spectral shape to reference average; 40% silence + noise floor HF-tilt → +3.1 dB inflation at 8–16 kHz in averaged reference spectrum; EQ transfer function over-boosts target HF; fix: gate silence from reference before matchering.process() — remove 50 ms frames with RMS < −50 dBFS; silence fraction: 40% → <2% in gated reference; HF inflation eliminated; “too bright” rate: 25% → 2.9%; HF deviation: +3.1 dB → +0.4 dB; client revision rate: 25% → 2.9%; 1.5h retainer engagement
Westfield Matchering Ltd. had built an automated audio mastering service processing 500 tracks per month for independent labels and artists. The service used matchering.process(target_path, reference_path, [result_path]) to match each client-uploaded track to their chosen reference master, applying matchering’s spectral EQ matching and RMS loudness normalization. For the majority of clients who chose commercial pop, electronic, or hip-hop masters as references — loud, dense recordings at −8 to −12 LUFS-I with low dynamic range — the results were well-received, with client revision requests below 3%. For the 25% of clients who submitted quiet, dynamic references — acoustic jazz recordings, chamber ensemble pieces, singer-songwriter masters with space and dynamics at −18 to −20 LUFS-I — the client revision rate was 25%: one in four masters was rejected as “too bright,” “too harsh in the high frequencies,” or “doesn’t sound like the reference.” A blind listener panel of 40 evaluators confirmed the pattern: for tracks mastered against quiet/dynamic references, 25% scored below 3.5 on a 5-point “matches reference tonal character” scale, specifically noting excessive brightness in the 8–16 kHz range. A matchering retainer developer was engaged to identify why quiet/dynamic references consistently produced overly bright results while loud/dense references did not.
The developer’s investigation began by measuring the HF level difference between each mastered track and its reference at 8 kHz and 16 kHz using a 30-second comparison excerpt, using librosa’s short-time Fourier transform and per-band RMS energy. For tracks mastered from loud/dense references (DR < 8), the HF level deviation was +0.3 dB on average — within the expected tolerance of matchering’s spectral smoothing. For tracks mastered from quiet/dynamic references (DR > 12), the HF level deviation was +3.1 dB on average — the master was consistently and substantially brighter than the reference. The developer then plotted the averaged reference spectral envelope (the internal spectrum matchering uses for the EQ transfer function) for 10 quiet/dynamic references and 10 loud/dense references, by running matchering in debug mode and extracting the internal spectral average after the FFT analysis step. The quiet/dynamic reference spectrograms showed a characteristic elevation above 8 kHz that was not present in the loud/dense references. Listening to 50ms segments from the quiet reference files, the developer confirmed the source: the near-silent sections between notes and phrases contained an audible room noise floor with a characteristic HF content (HVAC, equipment self-noise, A/D dither) that was elevated relative to the musical content’s HF/broadband ratio. For a jazz recording with 40% silence (measured by RMS gating at −50 dBFS), 40% of the spectral average came from these noise-floor frames, inflating the averaged HF spectrum by approximately 3.1 dB at 8–16 kHz. The fix was a reference pre-processing step: before calling matchering.process(), segment the reference into 50ms non-overlapping frames, discard any frame with RMS below −50 dBFS, concatenate the remaining voiced/musical frames, and write the concatenated audio as a temporary WAV file. This “gated reference” reduced the silence fraction from 40% to under 2% by frame count, eliminating the noise-floor contribution to the spectral average. The HF level deviation for quiet/dynamic references fell from +3.1 dB to +0.4 dB, the “too bright” listener panel rate fell from 25% to 2.9%, and client revision requests fell from 25% to 2.9%.
The reference profiling and noise-floor gating code, with the corrected matchering pipeline:
# Westfield Matchering Ltd. — matchering 2.0.6 quiet-reference HF inflation diagnostic
# matchering (sergree/matchering) 2.0.6; Python 3.9
# Deployment: automated audio mastering service, 500 tracks/month
# Problem: quiet/dynamic references (DR > 12) → silence frames inflate HF spectral avg +3.1 dB
# Fix: gate silence (RMS < -50 dBFS) from reference before matchering.process()
import numpy as np
import librosa
import soundfile as sf
import matchering as mg
import tempfile, pathlib
SILENCE_THRESHOLD_DBFS = -50.0 # frames below this RMS are silence/noise floor
FRAME_SIZE_S = 0.050 # 50ms frames for silence detection
def compute_rms_dbfs(audio: np.ndarray) -> float:
rms = float(np.sqrt(np.mean(audio ** 2)))
return 20.0 * np.log10(rms + 1e-9)
def profile_reference(ref_path: str, sr: int = 44100) -> dict:
"""
Measure integrated loudness, dynamic range proxy, and silence fraction
of a reference track to determine if noise-floor gating is needed.
"""
audio, file_sr = librosa.load(ref_path, sr=None, mono=True)
if file_sr != sr:
audio = librosa.resample(audio, orig_sr=file_sr, target_sr=sr)
frame_len = int(FRAME_SIZE_S * sr)
n_frames = len(audio) // frame_len
frames = audio[:n_frames * frame_len].reshape(n_frames, frame_len)
rms_db_per_frame = np.array([compute_rms_dbfs(f) for f in frames])
silence_mask = rms_db_per_frame < SILENCE_THRESHOLD_DBFS
silence_fraction = float(np.mean(silence_mask))
# Dynamic range proxy: difference between 95th and 10th percentile frame RMS
voiced_rms = rms_db_per_frame[~silence_mask]
dr_proxy = float(np.percentile(voiced_rms, 95) - np.percentile(voiced_rms, 10)) \
if len(voiced_rms) > 0 else 0.0
return {
"path": ref_path,
"silence_fraction": round(silence_fraction, 3),
"dr_proxy_db": round(dr_proxy, 1),
"needs_gating": silence_fraction > 0.15, # gate if >15% silence by frame count
}
def gate_reference(ref_path: str, sr: int = 44100) -> str:
"""
Remove near-silence frames from a reference track.
Returns path to a temporary WAV file containing only voiced/musical frames.
"""
audio, file_sr = librosa.load(ref_path, sr=None, mono=False)
if file_sr != sr:
audio = librosa.resample(audio, orig_sr=file_sr, target_sr=sr,
res_type='kaiser_best')
if audio.ndim == 1:
audio_mono = audio
stereo = np.vstack([audio, audio])
else:
audio_mono = np.mean(audio, axis=0)
stereo = audio
frame_len = int(FRAME_SIZE_S * sr)
n_frames = len(audio_mono) // frame_len
keep_frames = []
for i in range(n_frames):
frame = audio_mono[i * frame_len : (i + 1) * frame_len]
if compute_rms_dbfs(frame) >= SILENCE_THRESHOLD_DBFS:
keep_frames.append(i)
if not keep_frames:
return ref_path # no voiced frames found — use original as fallback
voiced_chunks = [stereo[:, i * frame_len : (i + 1) * frame_len]
for i in keep_frames]
voiced_audio = np.concatenate(voiced_chunks, axis=1).T # (N, 2)
tmp = tempfile.NamedTemporaryFile(suffix=".wav", delete=False)
sf.write(tmp.name, voiced_audio, sr, subtype='PCM_24')
return tmp.name
def master_track_buggy(target_path: str, reference_path: str,
output_path: str) -> None:
"""
Original implementation — no reference gating.
Quiet/dynamic references inflate HF spectrum +3.1 dB → master too bright.
"""
mg.process(
target = target_path,
reference= reference_path,
results = [mg.Result(output_path, use_limiter=True, normalize=False)],
)
def master_track_fixed(target_path: str, reference_path: str,
output_path: str, sr: int = 44100) -> None:
"""
Fixed implementation — gate silence from reference if needed.
Removes noise-floor frames from spectral analysis; HF deviation +3.1 → +0.4 dB.
"""
profile = profile_reference(reference_path, sr=sr)
if profile["needs_gating"]:
gated_ref = gate_reference(reference_path, sr=sr)
else:
gated_ref = reference_path
try:
mg.process(
target = target_path,
reference= gated_ref,
results = [mg.Result(output_path, use_limiter=True, normalize=False)],
)
finally:
if gated_ref != reference_path:
pathlib.Path(gated_ref).unlink(missing_ok=True) # clean up temp file
def measure_hf_deviation_db(master_path: str, reference_path: str,
sr: int = 44100,
fmin_hz: float = 8000.0,
excerpt_s: float = 30.0) -> float:
"""
Measure mean HF level difference (master vs reference) in fmin_hz+ band.
Uses first excerpt_s seconds of each file for a fair comparison.
Returns positive value if master is brighter than reference (dB).
"""
master_wav, _ = librosa.load(master_path, sr=sr, mono=True,
duration=excerpt_s)
ref_wav, _ = librosa.load(reference_path, sr=sr, mono=True,
duration=excerpt_s)
n_fft = 4096
hop = 1024
fmin_bin = int(fmin_hz / (sr / n_fft))
S_master = np.abs(librosa.stft(master_wav, n_fft=n_fft, hop_length=hop))
S_ref = np.abs(librosa.stft(ref_wav, n_fft=n_fft, hop_length=hop))
hf_master = 20.0 * np.log10(np.mean(S_master[fmin_bin:, :]) + 1e-9)
hf_ref = 20.0 * np.log10(np.mean(S_ref[fmin_bin:, :]) + 1e-9)
return round(float(hf_master - hf_ref), 2) # positive = master brighter
# --- Diagnostic: HF deviation for quiet vs loud references ---
test_pairs = [
# (target, reference, label)
("/tracks/indie_rock_01.wav", "/refs/jazz_quartet_dr14.wav", "jazz DR14, 42% silence"),
("/tracks/singer_songwriter.wav","/refs/piano_trio_dr13.wav", "classical DR13, 38% silence"),
("/tracks/acoustic_guitar.wav", "/refs/chamber_quartet_dr15.wav", "chamber DR15, 51% silence"),
("/tracks/pop_song.wav", "/refs/commercial_pop_dr6.wav", "pop DR6, 3% silence"),
("/tracks/edm_track.wav", "/refs/electronic_dr5.wav", "electronic DR5, 1% silence"),
]
print("matchering 2.0.6 — HF level deviation: buggy vs gated-reference pipeline")
print(f"{'Reference type':<40} {'HF dev (buggy) dB':<22} {'HF dev (gated) dB'}")
print("-" * 85)
for target, reference, label in test_pairs:
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f_b:
out_buggy = f_b.name
with tempfile.NamedTemporaryFile(suffix=".wav", delete=False) as f_f:
out_fixed = f_f.name
master_track_buggy(target, reference, out_buggy)
master_track_fixed(target, reference, out_fixed)
dev_buggy = measure_hf_deviation_db(out_buggy, reference)
dev_fixed = measure_hf_deviation_db(out_fixed, reference)
flag = " <-- too bright" if dev_buggy > 1.5 else ""
print(f" {label:<38} {dev_buggy:<22.2f} {dev_fixed:.2f}{flag}")
pathlib.Path(out_buggy).unlink(missing_ok=True)
pathlib.Path(out_fixed).unlink(missing_ok=True)
print()
print("Root cause: matchering averages STFT over entire reference including silence")
print(" Quiet/dynamic references (DR > 12): 30–50% silence by frame count")
print(" Noise floor (HVAC, dither) in silence frames: HF-elevated spectral shape")
print(" 40% silence × HF-tilted noise floor → +3.1 dB inflation at 8–16 kHz")
print(" EQ transfer function applies +3.1 dB HF boost to target")
print(" 25% of quiet-reference masters scored 'too bright'; revision rate 25%")
print()
print("Fix: gate silence (RMS < -50 dBFS) from reference before matchering.process()")
print(" Silence fraction: 40% → <2% in gated reference")
print(" Noise floor contribution to spectral average: eliminated")
print(" HF deviation: +3.1 dB → +0.4 dB")
print(" 'Too bright' rate: 25% → 2.9%; revision rate: 25% → 2.9%")
print(" Retainer engagement: 1.5h")
How matchering’s spectral averaging interacts with silence in dynamic recordings, and when noise-floor gating is required before analysis
matchering 2.0.6 builds its spectral transfer function from a full-file STFT magnitude average of the reference audio. This approach produces accurate results when the reference is a dense, produced commercial master where nearly every STFT frame contains music at a level well above the noise floor, and the spectral shape of any single frame is representative of the overall tonal balance. The approach has an inherent limitation for recordings with high dynamic range: the STFT average treats every frame equally regardless of its loudness, so frames at −20 dBFS (a forte musical passage) and frames at −75 dBFS (a quiet room noise floor between notes) contribute with equal weight to the spectral mean. For a recording with 40% silence at −72 dBFS average and 60% music at −18 dBFS average, the music frames are 54 dB (500×) louder in absolute energy — and yet they represent only 60% of the frame count in the STFT average, while the inaudible noise floor frames represent 40%.
The noise floor spectral shape of professional recordings is not flat: recording studio self-noise typically has a slight high-frequency tilt driven by A/D converter dither (spectrally white, so equal energy per Hz, which is relatively HF-elevated on a per-octave basis), transformer hum harmonics, and HVAC noise. For the jazz and classical references in this production pipeline, the silence-frame spectral shape showed 2–4 dB more energy at 8–16 kHz relative to 1–4 kHz compared to the music-only spectral shape. This 2–4 dB HF elevation in silence frames, weighted at 40% of the total, produced a 3.1 dB HF inflation in the full-file averaged reference spectrum. The gating threshold of −50 dBFS RMS (per 50ms frame) was chosen to be safely above the noise floor (−72 dBFS average) while still including soft musical content: pianissimo piano notes and sparse pizzicato strings at −40 to −48 dBFS pass the gate, while pure-silence frames do not. For references where the noise floor is very low (−80+ dBFS) and silence fraction is below 15%, the gating adds no value and can be skipped — the profile_reference() function’s needs_gating flag implements this logic, keeping the pipeline fast for the majority of commercial masters that do not need pre-processing.
Related retainer posts
- noisereduce developer on retainer — noisereduce 2.0.1; Python 3.9; podcast post-production 3,000 episodes/month; time_constant_s=2.0 causes 2s speech ducking at music-speech transitions; MOS 2.9; fix: time_constant_s=0.1 — 3 weeks
- soundfile developer on retainer — soundfile 0.12.1; Python 3.9; broadcast ingest 10,000 files/day; dtype='int16' silently clips float32 WAV with true-peak > 0 dBFS; 18% clipped; fix: float64 + np.clip + int16 cast — 3 weeks
- torchcrepe developer on retainer — torchcrepe 0.0.14; Python 3.9; pitch correction service 1,200 recordings/month; argmax decoder picks harmonic peak 28% in breathy falsetto; squeak artifacts 22% of recordings; fix: decoder=viterbi — 3 weeks
Track retainer hours without a client portal
HourTab turns your time-tracker CSV into a public URL your client bookmarks. No login. No portal. CSV in, URL out.
See pricing →