Dev.to Security πŸ” Cybersecurity πŸ‘ 0 πŸ“– 3 min read

Inside an Audio Deepfake Detector: MFCCs, CQCC and Raw Waveform Models

Recently, I had to read about anti-spoofing techniques in audio for work. I found it the easiest way to comprehend the whole thing by asking myself just one question – what does the model actually look at? And there are

Inside an Audio Deepfake Detector: MFCCs, CQCC and Raw Waveform Models

Recently, I had to read about anti-spoofing techniques in audio for work. I found it the easiest way to comprehend the whole thing by asking myself just one question – what does the model actually look at? And there are only three possible answers to it, which also correspond to three periods of development in the field.

The first possible answer is MFCCs. They originate from the world of speech recognition. In brief, audio is split into frames of 20 to 25 ms, its spectrum is computed, it is filtered via a mel filter bank corresponding to human hearing, the log of it is taken, and, finally, a Discrete Cosine Transform is done. The result is a compact vector per each frame.

Diagram of MFCC, CQCC and raw waveform pipelines in audio deepfake detection

Image created with AI assistance.

The issue here is that mel-scale tends to compress the high frequencies, and this is precisely the range in which many artifacts of synthesis occur. Vocoders and codecs are known to produce their fingerprints in the high frequency bands, along with small details in the spectrum that are smoothened out by MFCC. This is why the linear versions such as LFCC often perform better for spoof detection. In MΓΌller et al.'s study "Does Audio Deepfake Detection Generalize?", replacing melspec with cqtspec or logspec inputs improved EER by 37% on average.

The second choice is CQCC or Constant Q Cepstral Coefficients proposed by Todisco, Delgado and Evans from EURECOM in 2016. This idea was inspired from music analysis field. As the name suggests, in the case of Constant Q Transform the frequency bins are geometrically spaced, so we get better frequency resolution at lower frequencies and better time resolution at higher frequencies unlike a normal STFT where we get just one trade-off. We then follow with the same process of cepstrum calculation as before. Using this along with a simple GMM classifier on the ASVspoof 2015 dataset, the performance outperformed all the previously reported results, including those attacks not encountered during training.

The issue, which the authors point out themselves in their follow-up paper from 2017, is that optimal CQCC design depends on the nature of the attack and application scenario. A custom-built feature can generalize no further than the design decisions behind it.

The third solution is to not design any feature at all and train the model using raw audio. Tak et al. presented a RawNet2 architecture for spoof detection at ICASSP 2021. Its inputs are raw samples followed by a layer of learnable sinc band-pass filters, then residual layers and GRU. It performed particularly well on A17, a voice conversion attack, which was difficult for a hand-designed system in the ASVspoof 2019 LA dataset. AASIST, proposed by Jung et al. at ICASSP 2022, is an extension of RawNet2 encoder with graph attention over two different perspectives on spectra and time domain, as the artifacts may appear in either one. It achieved a 20% relative improvement over the state-of-the-art result and its lightweight version, with 85K parameters, even surpassed the competitors.

Finally, the less discussed bit. Benchmarks make all three families appear more competent than they really are. In the very same MΓΌller et al. paper, a collection of in-the-wild real and spoofed audio recordings of celebrities and politicians was compiled from the Internet. Those models trained on ASVspoof 2019 benchmark saw their EER get worse by somewhere between 200% and 1000% on that dataset, and frequently performed not much better than a random guess. A clean studio-trained dataset is just not representative of a cloned voice memo sent through WhatsApp and a smartphone speaker.

Key learning points. The front-end is much more important than one thinks, so don't just settle for melspecs. Learned front-ends, raw waveform or self-supervised speech models, tend to be more robust than static ones, but it's not some kind of black magic. And always test on out-of-domain compressed noisy audio before trusting any EER score.

I'm curious what front-end approaches other people use in practice, especially for telephony audio. Let me know in the comments.

If you want to go further, there's a good overview of a production audio analysis architecture, and a primer on how neural vocoders leave the artifacts these detectors look for.

Sources:

Note: I used AI tools while drafting this post and reviewed it before publishing. The cover and image were made with AI assistance.

Disclosure: I work as an AI intern at Neural Defend, a deepfake detection company. The Neural Defend guides linked above are from my employer.

πŸ“° Read the original article on Dev.to Security

Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β€” full credit and traffic to the original publisher.