Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use cepstral?

Recently I asked this question: How to get the fundamental frequency from FFT? (you don't actually need to read it)

My doubt right now it: how to use the cepstral algorithm?

I just don't know how to use it because the only language that I know is ActionScript 3, and for this reason I have few references about the native functions found in C, Java and so on, and how I should implement them on AS. Most articles are about these languages =/ (althought, answers in other languages than AS are welcome, just explain how the script works please)

The articles I found about cepstral to find the fundamental frequency of a FFT result told me that I should do this:

signal → FT → abs() → square → log → FT → abs() → square → power cepstrum

mathematically: |F{log(|F{f(t)}|²)}|²

Important info:

  • I am developing a GUITAR TUNER in flash
  • This is the first time I am dealing with advanced sound
  • I am using an FFT to extract frequency bins from the signal that reaches user's microphone, but I got stuck in getting the fundamental frequency from it

I don't know:

  • How to apply a square in an ARRAY (I mean, the data that my FFT gives me is an array. Should I multiply it by itself? ActionScript's debug throws errors when I try to fftResults * fftResults)
  • How to apply the "log". I would not know how to apply it even if I had a single number.
  • What is the difference between complex cepstral and power cepstral. Also, what of them should I use? I am trying to develop a guitar tuner.

Thanks!

like image 435
Lucas Speranza Avatar asked Feb 07 '11 19:02

Lucas Speranza


1 Answers

Note that the output of an FFT is an array of complex values, i.e. each bin = re + j*im. I think you can just combine the abs and square operations and calculate re*re + im*im for each bin. This gives you a single positive value for each bin, and obviously you can calculate the log value for each bin quite easily. You then need to do a second FFT on this log squared data and again using the output of this second FFT you will calculate re*re + im*im for each bin. You will then have an array of postive values which will have one or more peaks representing the fundamental frequency or frequencies of your input.

like image 142
Paul R Avatar answered Sep 22 '22 17:09

Paul R