RebelTechnology / OwlProgram

SDK for building dynamically loaded OWL patches
GNU General Public License v3.0
29 stars 20 forks source link

q15 fft #43

Closed giuliomoro closed 3 years ago

giuliomoro commented 8 years ago

According to the docs, no rescaling is performed when operating the integer-valued fft https://www.keil.com/pack/doc/CMSIS/DSP/html/group___real_f_f_t.html#ga053450cc600a55410ba5b5605e96245d

// forward fft
int forward = 0;
arm_rfft_init_q15(&instance, len, forward, 1);
arm_rfft_q15(&instance, (int16_t*)in.getData(), (int16_t*)out.getData());

gives the value of the fft divided by the number of elements.

According to the table in the docs this has to be interpreted as a fixed-point integer of format log2(size).(16-log2(size)), while the input is interpreted as 1.15.

Experimental measurements show that these values are correct.

giuliomoro commented 8 years ago

It took a second once I was able to printf.

bea2da563b633884f12a80836127853540fd7c7f including matlab example

With a typical musical signal, what happens is:

Conclusion: q15 fft is probably good only if you do not need to do fft/ifft. For instance, if you are only analyzing something in the frequency domain (e.g.: find the spectral centroid), it could be good enough.

pingdynasty commented 3 years ago

done in ShortFastFourierTransform