MFCC UGen extracts 13 spectral shape coefficients from an FFT frame for timbre classification in SuperCollider
Mel-Frequency Cepstral Coefficients (MFCCs) characterise the spectral envelope of a sound on a perceptually-weighted frequency scale. In SuperCollider, the MFCC UGen takes an FFT buffer, applies a mel filterbank, and outputs 13 control-rate coefficients. These 13 numbers describe the broad shape of the spectrum and are widely used as features for timbre recognition, classifier training, and audio similarity measurement. The coefficients change slowly and can be visualised with a MultiSliderView. Chapter 25 shows how to feed MFCC streams into machine learning classifiers.
Examples
fft = FFT(b.bufnum, SoundIn.ar(0)); array = MFCC.kr(fft); // 13 control-rate values per FFT frame c = Bus.new(‘control’, 0, 13); c.getn(13, { |val| { val.plot }.defer });
Assessment
Record 10-second examples of three different timbres and collect their MFCC vectors. Plot the first three coefficients. Explain why coefficient 0 (log energy) is often discarded before classification.