I am trying to detect the pitch of a given sound signal, so for that purpose, I wanted to find the Cepstrum of a that signal.
This is my code in MATLAB:
[x fs] = audioread('a.wav'); N = length(x); n = 0:N-1; figure, stem(n, x); X = fft(x, N); length(X) figure, stem(n, X); Y = X(1:6400); N = length(Y); n = 0:N-1; figure, stem(n, Y); Z = log(abs(Y)); figure, stem(n, Z); z = ifft(Z, N); figure, stem(n, z);
All I did was:
Compute the FFT of the audio signal and discard the 1st half since it is redundant.
Followed the standard procedure to compute the Cepstrum:
- Move to a logarithmic representation
- Compute the inverse FFT.
Based on what I saw on the internet, I expected evenly spaced peaks that would represent the definite pitch in the signal.
However, this is what I get:
I have no idea what can I do with this. Since what I have is a speech signal, I am not sure why there's not any evenly spaced peaks. Zooming in a bit, this is what I get:
This also doesn't help at all. I am having trouble understanding the way that the Cepstrum enables us to determine pitch frequency.
Even if I had something that resembled a proper Cepstrum, I doubt that I would be able to determine the pitch frequency from it, so any help is highly appreciated!