Sunday, 28 December 2014

FFT & cepstrum


270115 intend to do cepstrum. I feel excited todo cepstrum as it promise to love the harmonic problem. The 8.3ms corresponds to 120Hz. 

page4image11568

- 2 graph power and cepstrum
- cepstrum with freq on x axis
- link vertical marker on both graph
- display top right freq on both graph 

190115 start harmonic again. Make log axis. 
200115 do db label. 
210115 publish a frequency spectrum

230115 frequency spectrum piano
- add keyboard layout
- detect peak to note by x coord
- ignore noise

- freq class
- note location if it has only one freq in the fft. 

- I want to play a song from my baby toy piano. I want to know what notes to play. I want to playback the song And pause at the notes to see what they are. I want to play on a real piano to check the sound. 

080114
- try read wav file
- try 44100 and 1024, 2048 and 4096
- try 1 sec of the song I want 


050114 - mic

- cannot be sure the first few notes. Not responsive. Did not capture some of the notes I play. 
Read size. 
- try asyntask to make it responsive. It is way responsive but it is not accurate. Fft size 1024. Try 2048. Try bigger minbuffersize. 


Manage to get some success using mic input. It seems the android visualizer gives very bad signal. Record midi and fisher give bad estimation.

Using fft over time gives me good result in what is the keys being played. Need mic to be very close to speaker. 

1 min = 120 beats
X = 1 beat
X = 1/120

040114 - Keys
- do a simple note6080
- fft to get all freq
- convert freq to midi
- convert midi to key
- total up the magnitude
- present the top keys


Fft gives all the frequencies but some is fake. How to know which is the right one? They are not fake, just harmonic of the right frequency. 

Spectrogram can get all the freq and summaries the intensity of the tone. I see 463

030115
No the first harmonic is always right. It turns out to be the second. I am too tired to work in the night today. Just try all freq app in google play. There is no app that tells me what keys are being pressed. 

Take the first peak. 


020115
- cepstrum size needs to be same as wave sample size
- first fft needs to be log ( re x re + im x im) 
- cepstrum graph just need the real 

Trail 5. Increase 830hz period 
Input 
2 sin 830
1 sin 82
Result
I can see an amplitude increase in 800 freq and overtake 82. Look like cepstrum can capture high harmonic freq base. 

Fft gives all the frequencies. 86. 818. 1679. Take 86 since it is first freq. then take 832 as it is the highest peak and appear in fft. Ignore 1679 since there is no 1679 in cepstrum. 





- it seems that any freq that peaks at fft and cepstrum is the right freq from trail 4. Does not work.  

Trail 4. 
1 sin 261
1 sin 3 x 261
1 sin 82

Result: 
86 appears at both graph
258 appears at both. 



Trial 3 for 261hz. 
Cepstrum has no obvious peak for 1 sin wave or 2 sin wave at 261hz. 


Trial 2. 
Input 82 hz. Note 40. 
1 sin at 82
1 sin at 3x82
I get very good cepstrum at about 88hz. Even if I use only one sin wave, I get 88hz at cepstrum. 


Good Experiment 1. 
Input: 
1 sin at freq 830
1 sin at freq 3x830

Result: 
I get 830 frequency in cepstrum to be highest. 




- it is known that by listening to a pulse , one can know the health of a person. So by listening to a gear box, hard disk and car egine, turbine, baby, one can know the condition. Inner fault of ball bearing ring give. 90hz while outer ring gives 120hz. Power spectrum give 90hz for fault and inner fault but cepstrum gives only 90 hz for inner fault. Can I develop an app just to display the cepstrum?  

- try a sin wave with 500hz. And see its cepstrum. Can see the fft clearly at 430hz. But when try fft again to get cepstrum, the peaks are everywhere. 

- try jtransform. Easy to use. Only a jar file. Confirm my guess fft is symmetric. 

311214 the fft code I used seem to work up to size 16. Got another fft code but result is far off. 291 freq give 990. The result for fft is good but cepstrum is not stable. Is the formula wrong or my use is faulty? 

301214 try freq for byte and log. 
- try cepstrum to see freq

Byte has max 127. 130 will give -126. How do we know which is the correct answer? I think byte to int conversion. 




I am going to do a small test of using ceptrum to find the frequencies of a given sound. 

301214 do a waveform. Est note 60 to be 100hz when the correct answer is 261. The cycle is not perfect in wave form in direct waveform measurement. 


No comments:

Post a Comment