Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Java 

Spectrum Analyzer

So I have been doing some searching around and pretty much have found no help. I don't know if there is anyone on here that can help but it is worth a shot.

So basically my issue here is I want to create an app that will track cb radio frequencies to there exact location for and app that will tell you pretty much where every cop is on the road. The only way I know of that can track a radio frequency to it's exact location is by using a spectrum analyzer, I know the government uses these to track Pirate radio frequencies to protect ships against attacks. Now the question is their a way to code a spectrum analyzer in java? I know it would be hard and I am up for the task, I am just having a bit of trouble  finding out where to start. If anyone has any information on this then please let me know!

have no idea why it double posted either

Something like this. I know this isn't java but this is for an Arduino.
Code
int main(void)
{
  int N=250;
  double data[N];
  double samples[N];
  double freq;
  double s;
  double s_prev;
  double s_prev2;
  double coeff;
  double magn;
  int i;


  int gd=CUSTOM, gm=CUSTOM_MODE(700,700);
  initgraph(&gd, &gm, "");
  setcolor(WHITE);


  int X1,Y1,X2,Y2;
  double scale,xmin,ymin,xmax,ymax;


  // Find the maximum and minimum data range
  xmin=0;
  ymin=0;
  xmax=50000;
  ymax=N;
  scale=1.1*(xmax-xmin>ymax-ymin?xmax-xmin:ymax-ymin);


  // Generate samples
  for (i=0;i<N;i++) {
    samples[i]=(50*sin(2*M_PI*i*3300/SampleFreq)+50*sin(2*M_PI*i*5700/SampleFreq)+50*sin(2*M_PI*i*25700/SampleFreq)+100);
    // Window the data
    // data[i]=samples[i]; // Straight Goertzel - not great
    // data[i]=samples[i]*(0.5-0.25*cos(2*M_PI*i/N)); // Hanning Window
    data[i]=samples[i]*(0.54-0.46*cos(2*M_PI*i/N)); // Hamming Window
    // data[i]=samples[i]*(0.426551-0.496561*cos(2*M_PI*i/N)+0.076848*cos(4*M_PI*i/N)); // Exact Blackman Window
  }


  // Scan frequencies
  for (freq=100;freq<=50000;freq+=100) {
    coeff=2*cos(2*M_PI*freq/SampleFreq);
    s_prev=0.0;
    s_prev2=0.0;
    for (i=0;i<N;i++) {
      // Goertzel
      s=data[i]+coeff*s_prev-s_prev2;
      s_prev2=s_prev;
      s_prev=s;


    }


    // Get magnitude
    magn=2*sqrt(s_prev2*s_prev2+s_prev*s_prev-coeff*s_prev*s_prev2)/N;
    printf("Freq: %6f Mag: %6.4f\n",freq,magn);


    // Plot data
    X1=(int)((freq-(xmin+xmax)/2)*700/scale+350);
    Y1=(int)((0+(ymin+ymax)/2)*700/scale+650);
    X2=(int)((freq-(xmin+xmax)/2)*700/scale+350);
    Y2=(int)((-magn*700/2+(ymin+ymax)/2)*700/scale+650);
    line(X1,Y1,X2,Y2);


  }
  getchar();
  closegraph();


  return 0;
}
For future reference, centering text is a bad idea unless it's a title or image. It makes everything much harder to read.
I googled it and there a lot of tutorials, pretty detailed as well. Try to program along with those first and if you have any trouble you can PM me the question.
[Image: 89758]
(Aug 9, 2018 08:29 AM)hash Wrote:  I googled it and there a lot of tutorials, pretty detailed as well. Try to program along with those first and if you have any trouble you can PM me the question.

Those tutorials are for Arduino's. I want an app not an Arduino.
(Aug 10, 2018 10:24 AM)Eccentric Wrote:  Those tutorials are for Arduino's. I want an app not an Arduino.

That is not true. If you Google accordingly you will find a lot of Java tutorials.
[Image: 89758]
I think you can't do it in Java without any Hardware to detect and filter some signals on preselected frequencys.
You'll need something like a arduino or a RaspPi to build some hardware around it and process the data. After that you could send the data to a App or Server.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by EccentricAug 8, 2018 04:33 PM 0 114 Aug 8, 2018 04:33 PM
Last Post: Eccentric
[C#] by BaussHackerMay 28, 2018 07:04 AM 13 787 May 28, 2018 07:04 AM
Last Post: hytham606
[.NET] by PolarisGangMay 3, 2018 05:45 PM 3 263 May 3, 2018 05:45 PM
Last Post: PolarisGang