Go Down

Topic: Limiting fix_fft to a Band (Read 6838 times) previous topic - next topic

rickso234

Wow... quite nice! Pretty close to what I'm looking for... will attempt to digest the code later.

rickso234

So I like what was done in the Musical Notes Recognition code. Was able to input frequencies from a function generator and see energy in the corresponding bins. For music however, don't think there's enough dynamic range with the 8-bit FFT, even with range enhancement. I'd like to take the 16-bit code and wrap the features from the 8-bit code (command line, TIMER2, ...) around it to allow frequency range and Hz/bin control, and better dynamic range.

Magician

The things, for LED visualization of single musical instrument (piano), I skipped in the code one important part - expander. Basically, scaling procedure to fit input data in 8-bit array is nothing else than compression, and in order to get right values in the bins after processing complete, data have to be expanded back, using the exact values from amplification/shift variables.

rickso234

How do I expand the array values back? Full 8-bit amplitude resolution should give me 1.9mv steps (5V/256) which seems enough to evaluate music.

Magician

Quote
1.9mv steps (5V/256)

Check your calculator, mine shows:   5 / 256 = 0.01953125
Expanding: sorry , I'm not gonna write code for you. If you 've made sqrt for 256 bins instead of 48, multiply pred_displ[] values according "ysilit" and "shift" variables. Put your imagination to work, it's elementary math  :)

rickso234

You're right... I was off a factor of 10. 19mV/step is too much for music. As for the expander, I thought it was something you already had but but just didn't include... I can figure it out. Problem is, this FFT is just a small piece of a larger project, and I don't want to spend a lot on it.

Go Up