Showing posts with label fft. Show all posts
Showing posts with label fft. Show all posts

FFT library and plot

Since FFT was the subject, it seemed fitting to do some Fourier using the FFTW3 library on some audio. Using an example from the net as a starting point was a time saver in one way and not in another. Debugging code is always fun so ... I had used the AT&T voice server to get some audio for the expression "Segmentation fault" as an example and so that was the file to perform FFT with. Step one was to compile and it was necessary to add a few includes for memset and math to resolve some "implicit declaration warns" and it compiled fine. Next was running test and it printed out "Segmentation fault". It didn't seem there was a line to print the input wav file name, but it could have been overlooked. Since my mind is wandering it is an unusual thing that Spock used a Jewish ceremonial gesture as a "Vulcan" symbol of "live long and prosper".

So it took about one second to realize that it was a real SIGSEGV. It took another few minutes to scope out the fact that rplan was "NULL and VOID", which an assert would have been fitting if it was being proffered as something to be used by others, and the gnuplot code was a bit funky and that was fixed in about 30 seconds. Also it was using a "Magic" number to match the file data structure size, even though it is a given in the header of the .wav. Fixed and fixed. The code below shows the two methods of making the FFTW3 plan and the bottom will return NULL with the newer versions. Understandable, changing the spec is not likely to retrofit every code against an interface that is in flux. If the interface allows, somebody will cut that corner anyway so all in all it wasn't too much work to get the image above and left.



rplan = fftw_plan_r2r_1d(n, rdata, idata, FFTW_R2HC, FFTW_ESTIMATE); fftw_execute(rplan);

rplan = fftw_plan_r2r_1d(n, rdata, idata, FFTW_R2HC, FFTW_FORWARD); fftw_execute(rplan);

It does seem fitting that the wav file chosen was "Segmentation fault" by name and content, as if it was an omen of the future. It would have been more fun if SDL sound was included and "Segmentation fault" was spoken right before it crashed.

Integration of graphics scripts

This is available in repositories and I used it before, but now to see if FFT and wavelet interaction has something to be learned.

sudo apt-get install fftw3-dev libgimp2.0-dev

This is a decomposed image and it is in filters->Generic. The script code must be compiled and installed in the plugins so that it can be registered. I am wondering whether to Google to Blog and and then back can be recomposed? (Obviously not.


It is interesting what is lost in transit and one has to wonder how the compression and decompression are done and/or how choices are made.

What I wanted to know is what does the Fourier of a decomposed wavelet look like?


So this is the image with an overlay of various FFTs and it speaks volumes to me. In addition it is possible to extract many more things. One could say that there is an near infinity to be comprehended there. Analysis in other dimensions is also very interesting. This is just preparation as I have a new tool I want to test on the image and it combines several filters and plug-ins into a concert of action and this is to test if it does what is predicted.

On a side note, there is duplicate invention and the path to the answer is not usually the same. It is an infinite landscape and you can get to there from any where. So this link at slashdot and it may be yesterday sooner than I guessed. Of course if people understood Tesla's work, this perhaps could have been true a hundred years ago.

Contributors

Automated Intelligence

Automated Intelligence
Auftrag der unendlichen LOL katzen