Wednesday, May 4, 2011

Fourier

Time has been progressing.

Slowly.

Anyone who watches the BN SourceForge page (Now known as 'BNSF') will have noticed that Sunday night I posted four different feature requests. I realized that the school year is running out... So I decided that I need to dedicate more time to this project, since school is... school :) I'll start implementing these features after I finish the Fourier transform stuff (see below). Then, in two or three weeks time the Game Testing Team (you know who you are) will host a LAN party, and we'll nail down as many bugs and interface problems as possible. Then, we'll fix all of the bugs. Repeat.

I have new found knowledge of the Fourier transform system. One fact is that you should never, ever try to make your own library: mine still doesn't work. Now I'm using the FFTW library, which works well... but has some idiosyncrasies of its own.  My new knowledge of the DFT is that of the windowing function and bin leakage. But, I have decided that I DON'T CARE. On board an actual ship, there will still be bin leakage in the SONAR detection, so I can just include the bin leakage as part of the acoustic profile of each component. This has the drawback that propagation loss will be messed up, as higher frequency leakage will propagate as if it were actually traversing the ocean. Oh, well, I guess it'll be fixed at some point :)
Acoustic Leakage Pipeline


When I last posted, I had setup a eureqa system to hunt down the component frequencies of a particular audio file. Turns out that this has some downsides... Eureqa is a great program, but it was not intended for acoustical analysis. I killed the job after eight days and 1,500 core hours. We found two waveforms. I know that there's more.

But this leads me to a new conclusion. What if we had a program that would perform an optimized GA for acoustical analysis? We could implement it by taking the DFT of a waveform, and marking the peaks. Then, we just start adding the tallest peaks as single sinusoids, and recalculate the DFT each time we add a new wave. Then, we get the effect of the bin leakage in terms of the waves, so that when the final sum of sines is read by a computer and spectroanalyzed, it shows the proper spectrograph. I'll implement this when I get some time on my hands, but for now I'll just hand-generate a waveform for the propeller. I might also switch the bin system to be logarithmic, because at the moment the system is linear: there's a 10-110Hz bin, and a 19000-19100Hz bin. Doesn't quite work as well as I had hoped...

On the subject of acoustics, I had an epiphany with how to take into account thermoclines. What we will do is assume that all thermoclines occur in transitions between solid blocks of water-temperature-areas. We'll just say that at, say, 100m, the water changes suddenly to some different temperature. We can calculate how to measure the speed of sound in water for the two areas. Then, we can just use Snell's law to figure out the amount that it refracts. We can just setup a triangle... and we have the new distance in each medium, which can be passed to the propagation function to calculate the overall propagation.
Path of Acoustical waves through the thermocline

Oh, and speaking of the Game Testing Team: the default BN scenario, the one that loads by default (you can change it with the '--scenario=' flag), now includes a really dumb target. It should be visible on SONAR, as well as visually, from load time.

No comments:

Post a Comment