# Cepstrum: IFFT or FFT to enter the cepstral domain?

I'm trying to implement source-filter separation of some pre-recorded speech in Max/MSP. I'm unsure of whether one uses an FFT to enter the cepstral domain, or an IFFT. Some of the textbooks and dissertations I've found that cover this topic say that I should perform an FFT to get into the cepstral domain and then an IFFT to exit back into the frequency domain; others say that I should perform an IFFT to enter the cepstral domain and then an FFT to get back into the frequency domain! The first way makes more sense to me, but something about my patch isn't quite working quite right, and I'm not sure what I'm doing wrong.

Here is how I understand the procedure (Please tell me if you notice anything incorrect):

1. Perform an FFT on the time-domain signal to enter the frequency domain.
2. Do Mel scaling (optional) and then logify.
3. Do an FFT (or an IFFT, depending on who you ask) to enter the cepstral domain.
4. Separate the low bins (the filter) from the high bins (the source / excitation signal).
5. Perform an IFFT (or an FFT, depending on who you ask) on both source and filter to exit back into the frequency domain.
6. Exponentiate both source and filter.
7. Modify amplitude of filter bins.
8. Multiply the modified filter with the source signal.
9. Un-Mel-scale (optional).
10.Perform an IFFT to exit back into the time domain.


In Step 3, should I use an FFT or an IFFT? (And then Step 5 will be the opposite of whatever Step 3 is.)

P.S.: I am not trying to modify phase information, only change some amplitude information of the filter portion of the signal (the lower FFT bins in the cepstral domain) before I add/multiply them back together.

• I've only heard it defined as the IFT of either the log-power or log-magnitude spectra. Feb 19 '18 at 8:57
• @hulappa What's the difference between "log-power" and "log-magnitude"? Not all of the papers I've been reading seem to mention that part (some of them only mention the logifying, perhaps for the sake of brevity), but I feel like it's an important element that I should understand.
– ksoo
Feb 19 '18 at 16:08
• What I mean with log-magnitude is taking log(abs(X)), where X is your complex-valued input spectrum. Log-power would be log((abs(X))^2). Feb 20 '18 at 16:56
• @hulappa Ah. What would be the advantage of doing the squaring in addition to the absolute value-ing? Better scaling?
– ksoo
Feb 21 '18 at 2:41
• Note that log(x^a) = a log(x). That is, doing the squaring amounts to scaling the results you get using the absolute value by two. So there is really no advantage of doing it. Its just that it is sometimes defined that way. Feb 21 '18 at 3:05

For Cepstrum I always have used to this steps:

• Apply hamming windows in the signal

• Apply FFT

• Get magnitude

• Convert to log scale

• Apply IFFT

The equation for cepstrum:

IFFT(log(abs(FFT(s))))


But you can use FFT or IFFT, take a look:

IFFT(log(abs(FFT(s)))) == real(FFT(log(abs(FFT(s)))))


The difference is the scale representation, if do you end using FFT you need extract just the real information, for both above equations you will get the same shape:

For IFFT(log(abs(FFT(s)))):

For real(FFT(log(abs(FFT(s))))):

This is a cepstrum shape example from 4096 points sine in 440hz sampled at 44100hz

• Thank you so much for taking the time to answer my question! Since I'm trying to resynthesize afterwards, do I need to do a complex cepstrum (and keep both the real and imaginary parts)? Additionally, would that affect whether or not I need to "get the magnitude" of the signal before logifying?
– ksoo
Feb 19 '18 at 16:06