diff --git a/README.md b/README.md index e1fe5f4..dd22792 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ energy. Everything above this point is silence or noise. **The Nyquist ceiling:** Digital audio is made of snapshots (samples). For CD quality (44100 snapshots per second), there is a hard limit: you cannot store a frequency higher than half the snapshot rate = **22050 Hz**. This is called -the *Nyquist frequency*. It is a physical ceiling — higher frequencies simply +the *Nyquist frequency*. It is a physical ceiling - higher frequencies simply cannot exist. **How lossy encoding changes it:** MP3 and other lossy codecs deliberately cut @@ -84,7 +84,7 @@ off high frequencies to save space. The cutoff gets lower as the bitrate drops: close to the theoretical maximum. This is what we expect from a 320 kbps encode. If this same file showed 54% (~12000 Hz), it would mean the treble was chopped off by an aggressive low-bitrate encoder, and someone just -re-encoded it at 320 kbps — the cutoff is permanent and cannot be restored. +re-encoded it at 320 kbps - the cutoff is permanent and cannot be restored. That would be an **UPSCALED** file. --- @@ -96,9 +96,9 @@ tcd measures this as the frequency gap between the −20 dB point (still loud) and the −60 dB cutoff (essentially silent). A narrow gap = a sharp drop. **The analogy:** Imagine the frequency graph as a mountain ridge. A lossless -recording rolls off like a natural hillside — gradual, smooth, taking +recording rolls off like a natural hillside - gradual, smooth, taking thousands of Hz to go from loud to silent. A lossy encoder's lowpass filter -creates a cliff — a near-vertical drop from audible signal to nothing. +creates a cliff - a near-vertical drop from audible signal to nothing. **What the number means:** Steepness is the width (in Hz) of that drop zone. The smaller the number, the sharper the cliff: @@ -111,11 +111,11 @@ The smaller the number, the sharper the cliff: | >5000 Hz | Gentle slope | Natural acoustic roll-off (lossless) | To understand steepness, imagine a guitar string being plucked. The sound -naturally fades across many frequencies — the harmonics near the top end of +naturally fades across many frequencies - the harmonics near the top end of your hearing get quieter and quieter over a broad range. This is a gentle slope. Now imagine someone put a pair of scissors on the frequency spectrum -and cut everything above a certain note. That sharp edge — the difference -between "still audible" and "completely gone" in just a few hundred Hz — is +and cut everything above a certain note. That sharp edge - the difference +between "still audible" and "completely gone" in just a few hundred Hz - is what lossy compression does. The steepness number tells you how sharp that scissor cut was. @@ -126,7 +126,7 @@ scissor cut was. **What it measures:** How "bumpy" or "irregular" the spectrum looks just before the cutoff point. -**The analogy:** Lossy encoding introduces quantization noise — tiny +**The analogy:** Lossy encoding introduces quantization noise - tiny rounding errors that are unevenly distributed across frequencies. In the frequency graph, this looks like a jagged, bumpy line instead of a smooth one. Think of it like a dirt road vs a paved highway: lossless audio is @@ -161,10 +161,10 @@ is severe. | Band ratio | What it means | |------------|---------------| -| >0.85 | Healthy high end — likely native lossless | -| 0.70–0.85 | Mild roll-off — could be lossy or natural | -| 0.50–0.70 | Significant high-end loss — likely lossy | -| <0.50 | Severe high-end loss — almost certainly lossy or transcoded | +| >0.85 | Healthy high end - likely native lossless | +| 0.70–0.85 | Mild roll-off - could be lossy or natural | +| 0.50–0.70 | Significant high-end loss - likely lossy | +| <0.50 | Severe high-end loss - almost certainly lossy or transcoded | --- @@ -173,8 +173,8 @@ is severe. **What it measures:** The average noise level in the highest quarter of the frequency range (roughly 16500–22050 Hz). -**The analogy:** Imagine listening in a quiet room — the background hiss is -very low. Now imagine that same room with a fan running — the background +**The analogy:** Imagine listening in a quiet room - the background hiss is +very low. Now imagine that same room with a fan running - the background noise rises. A lossy encoder introduces quantization noise that raises the "background hiss" in the high frequencies. @@ -183,10 +183,10 @@ quieter (better). Less negative = noisier (worse): | Noise floor | What it means | |-------------|---------------| -| −90 to −110 dB | Very clean — native lossless | -| −70 to −90 dB | Moderate — could be lossy or quiet lossless | -| −50 to −70 dB | Noisy — likely lossy | -| >−50 dB | Very noisy — almost certainly lossy or transcoded | +| −90 to −110 dB | Very clean - native lossless | +| −70 to −90 dB | Moderate - could be lossy or quiet lossless | +| −50 to −70 dB | Noisy - likely lossy | +| >−50 dB | Very noisy - almost certainly lossy or transcoded | --- @@ -215,7 +215,7 @@ the file is **UPSCALED**. For example, a file claiming 320 kbps (expecting ≥90%) but showing a cutoff of 70% (≈15400 Hz) would be flagged as upscaled from ~96 kbps. -Otherwise it is **NATIVE** — a genuine single encode at this bitrate. +Otherwise it is **NATIVE** - a genuine single encode at this bitrate. ### Scenario 2: The input file is lossless (FLAC, WAV, ALAC, etc.) @@ -224,7 +224,7 @@ decoding a lossy file and re-encoding to lossless? tcd uses a **two-layer** check: -**Layer 1 — Cutoff + Steepness (primary):** +**Layer 1 - Cutoff + Steepness (primary):** | Cutoff range | Max steepness allowed | If exceeded → | |-------------|----------------------|---------------| @@ -236,10 +236,10 @@ tcd uses a **two-layer** check: This works because lossy cutoffs are always sharp (low steepness). A lossless recording that happens to have a low cutoff (e.g., a muddy recording with -little treble) would still have a *gradual* roll-off (high steepness) — you +little treble) would still have a *gradual* roll-off (high steepness) - you need both a low cutoff **and** a sharp drop to convict. -**Layer 2 — Roughness + Band ratio (secondary):** +**Layer 2 - Roughness + Band ratio (secondary):** If Layer 1 did not trigger but the cutoff is above 80%, tcd checks roughness and band ratio. This catches transcodes where the cutoff happens to be high @@ -260,9 +260,9 @@ If neither layer triggers, the file is **GENUINE** (native lossless). | Verdict | Input codec | What it means | |---------|------------|---------------| -| **NATIVE** | lossy | Encoded once at the stated bitrate — genuine | +| **NATIVE** | lossy | Encoded once at the stated bitrate - genuine | | **UPSCALED** | lossy | Originally encoded at a lower bitrate, then re-encoded higher | -| **GENUINE** | lossless | Appears to be native lossless — no evidence of lossy origin | +| **GENUINE** | lossless | Appears to be native lossless - no evidence of lossy origin | | **TRANSCODE** | lossless | Originated from a lossy source, decoded to lossless | | **SILENT** | any | No detectable audio content | @@ -282,7 +282,7 @@ Auto-remove mode (`-a`) When `-a` is passed, any file that is not classified as NATIVE or GENUINE is automatically deleted after analysis. This is useful for batch cleanup of -corrupt or transcoded libraries. Careful — this will eat data. +corrupt or transcoded libraries. Careful - this will eat data. --- @@ -292,7 +292,7 @@ Why the method is (somewhat!) scientifically reliable ### 1. Lossy encoding leaves a permanent spectral fingerprint Every lossy audio codec discards information. The most obvious form is a -**lowpass filter** — once applied, the frequencies above the cutoff are gone +**lowpass filter** - once applied, the frequencies above the cutoff are gone forever. Decoding back to PCM and re-encoding to lossless cannot restore them. This means a "lossless" FLAC file made from an MP3 will contain the MP3's permanent spectral cutoff.