|
4 | 4 | :sc-related: Guides/FluidCorpusManipulationToolkit, Guides/FluidBufMultiThreading, Classes/FluidBufMelBands |
5 | 5 | :see-also: |
6 | 6 | :description: |
7 | | - This class implements a classic spectral descriptor, the Mel-Frequency Cepstral Coefficients (https://en.wikipedia.org/wiki/Mel-frequency_cepstrum). The input is first filtered in to **numBands** perceptually-spaced bands, as in Classes/FluidMelBands. It is then analysed into **numCoeffs** number of cepstral coefficients. It has the advantage of being amplitude invariant, except for the first coefficient. It is part of the Guides/FluidCorpusManipulationToolkit of Guides/FluidCorpusManipulationToolkit. For more explanations, learning material, and discussions on its musicianly uses, visit http://www.flucoma.org/ |
8 | | - |
9 | | - The process will return a single multichannel buffer of **numCoeffs** per input channel. Each frame represents a value, which is every hopSize. |
| 7 | + |
| 8 | + MFCC stands for Mel-Frequency Cepstral Coefficients ("cepstral" is pronounced like "kepstral"). This analysis is often used for timbral description and timbral comparison. It compresses the overall spectrum into a smaller number of coefficients that, when taken together, describe the general contour the the spectrum. |
10 | 9 |
|
| 10 | + The MFCC values are derived by first computing a mel-frequency spectrum, just as in :fluid-obj:`MelBands`. ``numCoeffs`` coefficients are then calculated by using that mel-frequency spectrum as input to the discrete cosine transform. This means that the shape of the mel-frequency spectrum is compared to a number of cosine wave shapes (different cosines shapes created from different different frequencies). Each MFCC value (i.e., "coefficient") represents how similar the mel-frequency spectrum is to one of these cosine shapes. |
11 | 11 |
|
| 12 | + Other that the 0th coefficient, MFCCs are unchanged by differences in the overall energy of the spectrum (which relates to how we perceive loudness). This means that timbres with similar spectral contours, but different volumes, will still have similar MFCC values, other than MFCC 0. To remove any indication of loudness but keep the information about timbre, we can ignore MFCC 0 by setting the parameter ``startCoeff`` to 1. |
12 | 13 |
|
| 14 | + For more information visit https://learn.flucoma.org/reference/mfcc/. |
| 15 | + |
| 16 | + For an interactive explanation of this relationship, visit https://learn.flucoma.org/reference/mfcc/explain. |
| 17 | + |
13 | 18 | :control source: |
14 | 19 |
|
15 | | - The index of the buffer to use as the source material to be described through the various descriptors. The different channels of multichannel buffers will be processing sequentially. |
| 20 | + The index of the buffer to use as the source material to be analysed. The different channels of multichannel buffers will be processing sequentially. |
16 | 21 |
|
17 | 22 | :control startFrame: |
18 | 23 |
|
19 | | - Where in the srcBuf should the process start, in sample. |
| 24 | + Where in the ``srcBuf`` the analysis should start, in samples. The default is 0. |
20 | 25 |
|
21 | 26 | :control numFrames: |
22 | 27 |
|
23 | | - How many frames should be processed. |
| 28 | + How many frames should be analysed. The default of -1 indicates to analyse to the end of the buffer. |
24 | 29 |
|
25 | 30 | :control startChan: |
26 | 31 |
|
27 | | - For multichannel srcBuf, which channel should be processed first. |
| 32 | + For a multichannel ``srcBuf``, which channel should be processed first. The default is 0. |
28 | 33 |
|
29 | 34 | :control numChans: |
30 | 35 |
|
31 | | - For multichannel srcBuf, how many channel should be processed. |
| 36 | + For a multichannel ``srcBuf``, how many channels should be processed. The default of -1 indicates to analyse through the last channel. |
32 | 37 |
|
33 | 38 | :control features: |
34 | 39 |
|
35 | | - The destination buffer for the numCoeffs coefficients describing the spectral shape. |
| 40 | + The destination buffer to write the MFCC analysis into. |
36 | 41 |
|
37 | 42 | :control numCoeffs: |
38 | 43 |
|
39 | | - The number of cepstral coefficients to be outputed. It will decide how many channels are produce per channel of the source. |
| 44 | + The number of cepstral coefficients to return. The default is 13. |
40 | 45 |
|
41 | 46 | :control numBands: |
42 | 47 |
|
43 | | - The number of bands that will be perceptually equally distributed between **minFreq** and **maxFreq**. |
| 48 | + The number of bands that will be perceptually equally distributed between ``minFreq`` and ``maxFreq``. The default is 40. |
44 | 49 |
|
45 | 50 | :control startCoeff: |
46 | 51 |
|
47 | | - The lowest index of the output cepstral coefficient, zero-counting. |
| 52 | + The lowest index of the output cepstral coefficients to return, zero-counting. This can be useful to skip over the 0th coefficient (by indicating ``startCoeff`` = 1), because the 0th coefficient is representative of the overall energy in spectrum, while the rest of the coefficients are not affected by overall energy, only the mel-frequency spectral contour. The default is 0. |
48 | 53 |
|
49 | 54 | :control minFreq: |
50 | 55 |
|
51 | | - The lower boundary of the lowest band of the model, in Hz. |
| 56 | + The lower bound of the frequency band to use in analysis, in Hz. The default is 20. |
52 | 57 |
|
53 | 58 | :control maxFreq: |
54 | 59 |
|
55 | | - The highest boundary of the highest band of the model, in Hz. |
| 60 | + The upper bound of the frequency band to use in analysis, in Hz. The default is 20000. |
56 | 61 |
|
57 | 62 | :control windowSize: |
58 | 63 |
|
59 | | - The window size. As MFCC computation relies on spectral frames, we need to decide what precision we give it spectrally and temporally, in line with Gabor Uncertainty principles. http://www.subsurfwiki.org/wiki/Gabor_uncertainty |
| 64 | + The window size. As MFCC computation relies on spectral frames, we need to decide what precision we give it spectrally and temporally, in line with Gabor Uncertainty principles. http://www.subsurfwiki.org/wiki/Gabor_uncertainty. The default is 1024. |
60 | 65 |
|
61 | 66 | :control hopSize: |
62 | 67 |
|
|
68 | 73 |
|
69 | 74 | :control padding: |
70 | 75 |
|
71 | | - Controls the zero-padding added to either end of the source buffer or segment. Possible values are 0 (no padding), 1 (default, half the window size), or 2 (window size - hop size). Padding ensures that all input samples are completely analysed: with no padding, the first analysis window starts at time 0, and the samples at either end will be tapered by the STFT windowing function. Mode 1 has the effect of centering the first sample in the analysis window and ensuring that the very start and end of the segment are accounted for in the analysis. Mode 2 can be useful when the overlap factor (window size / hop size) is greater than 2, to ensure that the input samples at either end of the segment are covered by the same number of analysis frames as the rest of the analysed material. |
72 | | - |
73 | | -:control maxNumCoeffs: |
74 | | - |
75 | | - The maximum number of cepstral coefficients that can be computed. This sets the number of channels of the output, and therefore cannot be modulated. |
76 | | - |
77 | | -:control maxFFTSize: |
78 | | - |
79 | | - How large can the FFT be, by allocating memory at instantiation time. This cannot be modulated. |
80 | | - |
| 76 | + Controls the zero-padding added to either end of the source buffer or segment. Possible values are 0 (no padding), 1 (default, half the window size), or 2 (window size - hop size). Padding ensures that all input samples are completely analysed: with no padding, the first analysis window starts at time 0, and the samples at either end will be tapered by the STFT windowing function. Mode 1 has the effect of centring the first sample in the analysis window and ensuring that the very start and end of the segment are accounted for in the analysis. Mode 2 can be useful when the overlap factor (window size / hop size) is greater than 2, to ensure that the input samples at either end of the segment are covered by the same number of analysis frames as the rest of the analysed material. |
0 commit comments