public class Tracking
{
static float the_freq;
static float the_gain;
static Event @ the_event;
}
new Event @=> Tracking.the_event;
adc => PoleZero dcblock => FFT fft => blackhole;
.99 => dcblock.blockZero;
2048 => fft.size;
Windowing.hamming( fft.size() ) => fft.window;
while( true )
{
fft.upchuck() @=> UAnaBlob blob;
0 => float max; float where;
for( int i; i < blob.fvals().size()/8; i++ )
{
if( blob.fvals()[i] > max )
{
blob.fvals()[i] => max;
i => where;
}
}
(where / fft.size() * (second / samp)) => Tracking.the_freq;
(max / .5) => Tracking.the_gain;
if( Tracking.the_gain > 1 )
1 => Tracking.the_gain;
Tracking.the_event.broadcast();
(fft.size()/4)::samp => now;
}