Voice cloning went from research demo to everyday scam tool in about two years. A few seconds of someone's voice from a Reel or a WhatsApp note can be enough to clone it, and "family emergency" calls using cloned voices are now a common fraud pattern in India and elsewhere.
So how do you detect a fake voice? In this post we'll look at how audio deepfake detection works under the hood, then write a small Python script that extracts the kinds of features detectors use. It's a learning project, not a production detector, but it'll help you understand what real systems look at and why they still make mistakes.
How voice cloning works (briefly)
Most modern voice clones are produced by a pipeline like this:
- Text-to-speech or voice conversion model generates an intermediate representation, usually a mel spectrogram, in the target speaker's style.
- A neural vocoder turns that spectrogram into an audio waveform.
Both stages leave subtle traces. Detectors try to find them.
What detectors look for
1. Spectral artifacts from the vocoder
Neural vocoders are good, but not perfect. They can leave:
- Unnatural energy patterns in the high frequencies (roughly above 4–6 kHz)
- Overly smooth or repetitive harmonic structure
- Odd behaviour in the phase of the signal, which humans barely notice
2. Missing "messiness" of real speech
Real speech is full of small imperfections: breaths, mouth clicks, background room tone, tiny variations in pitch and timing. Synthetic speech is often too clean and too regular.
3. Prosody and timing
Pitch (F0) contours, pause lengths and speaking rate in cloned voices can be flatter or more uniform than a real person under stress, which is ironic given how emotional scam calls try to sound.
4. Learned features
State-of-the-art systems don't rely on hand-picked rules. They train deep models on large datasets of real and fake audio. The research community benchmarks these on the ASVspoof challenges, which have run since 2015 and include logical-access (TTS and voice conversion) and deepfake tracks.
Hands-on: extract detector-style features in Python
Let's compute a few features that classic detectors used, and compare a real recording with a synthetic one you generate yourself (for example with any TTS tool, using your own voice or a stock voice, never someone else's without permission).
pip install librosa numpy
# audio_features.py
import sys
import numpy as np
import librosa
def features(path):
y, sr = librosa.load(path, sr=16000, mono=True)
# 1) Spectral roll-off: frequency below which 85% of energy sits
rolloff = librosa.feature.spectral_rolloff(y=y, sr=sr, roll_percent=0.85).mean()
# 2) High-frequency energy ratio (above 4 kHz)
S = np.abs(librosa.stft(y, n_fft=1024)) ** 2
freqs = librosa.fft_frequencies(sr=sr, n_fft=1024)
hf_ratio = S[freqs > 4000].sum() / S.sum()
# 3) Spectral flatness: how "noise-like" vs "tonal" the signal is
flatness = librosa.feature.spectral_flatness(y=y).mean()
# 4) Pitch variability (F0 standard deviation in voiced frames)
f0, voiced, _ = librosa.pyin(y, fmin=65, fmax=400, sr=sr)
f0_std = np.nanstd(f0[voiced]) if voiced.any() else float("nan")
# 5) Pause structure: share of near-silent frames
rms = librosa.feature.rms(y=y)[0]
silence_ratio = (rms < 0.1 * rms.max()).mean()
return {
"rolloff_hz": round(float(rolloff), 1),
"hf_energy_ratio": round(float(hf_ratio), 4),
"spectral_flatness": round(float(flatness), 4),
"f0_std_hz": round(float(f0_std), 1),
"silence_ratio": round(float(silence_ratio), 3),
}
if __name__ == "__main__":
for p in sys.argv[1:]:
print(p, features(p))
python audio_features.py real_me.wav tts_me.wav
You'll often see differences in high-frequency energy, flatness or pitch variability between the two. But try a few more samples and you'll also notice the problem: the differences aren't consistent. Compression, phone lines, background noise and the specific TTS model all shift these numbers.
That's exactly why hand-picked features gave way to trained models.
From features to a real detector
A production audio deepfake detector typically:
- Converts audio to a time-frequency representation (spectrograms, LFCCs or raw waveform)
- Feeds it to a neural network trained on large, diverse real and fake datasets
- Outputs a score per segment, so you can see where in a call the voice looks synthetic
- Is re-trained regularly, because new voice models appear constantly
Even then, accuracy drops on phone-quality audio, heavy compression (WhatsApp voice notes), noisy recordings and voice models it has never seen.
What this means for builders
If you're adding voice verification or fraud checks to an app:
- Don't rely on voice alone for authentication. Voice biometrics can be spoofed. Combine with device signals, OTPs or call-back flows.
- Use detection as a risk signal, routing suspicious calls or uploads to extra verification, not as an automatic block.
- Design for out-of-band checks. The best defence against a cloned "family member" is still a call back to a known number or a pre-agreed code word.
Wrapping up
Audio deepfake detection looks at vocoder artifacts, missing natural noise, prosody and, above all, patterns learned from large datasets. Hand-crafted features are a great way to build intuition, but real-world detection needs trained models, diverse data and humility about error rates.
At ProofAI we currently focus on detecting AI-generated text, documents and images. You can try them free at proofai.in, and the API docs cover integration.
Should we do a follow-up training a small spectrogram classifier on ASVspoof data? Tell us in the comments. 👇
Disclosure: we're the team behind ProofAI at 4Born Solutions. This article was drafted with AI assistance and reviewed and edited by our team. Only clone voices you have permission to use.
Top comments (0)