RadioBanter

RadioBanter (https://www.radiobanter.com/)
-   Digital (https://www.radiobanter.com/digital/)
-   -   analizing rf signals (https://www.radiobanter.com/digital/148331-analizing-rf-signals.html)

Raymond BARBER December 1st 09 03:08 PM

analizing rf signals
 
Am trying to write C program to use sound card to input rf signals into
computer and then analise them. Would appreciate help on programming sound
card etc

73
Ray G3NEF



Rob[_8_] December 1st 09 04:30 PM

analizing rf signals
 
Raymond BARBER wrote:
Am trying to write C program to use sound card to input rf signals into
computer and then analise them. Would appreciate help on programming sound
card etc


Anything that existing programs like SPECLAB don't do?

Karl Beckman December 1st 09 07:20 PM

analizing rf signals
 
There is an issue of useable bandwidth. Sound cards generally don't respond
to much above 20 kHz. Do you propose to convert the RF signals down into
the audio baseband without destroying the information which you are trying
to analyze?

--
Karl Beckman, P.E.
Motorola Govt & Public Safety
OH21 440-717-3992


"Raymond BARBER" wrote in message
...
Am trying to write C program to use sound card to input rf signals into
computer and then analise them. Would appreciate help on programming sound
card etc

73
Ray G3NEF




Rob[_8_] December 2nd 09 09:57 AM

analizing rf signals
 
Karl Beckman wrote:
There is an issue of useable bandwidth. Sound cards generally don't respond
to much above 20 kHz. Do you propose to convert the RF signals down into
the audio baseband without destroying the information which you are trying
to analyze?


That is no problem when you want to analyze narrowband signals, isn't it?

With a stereo soundcard sampling at 44.1 kHz and I/Q mixing you can
handle a 40 kHz wide portion of RF spectrum. Enough for most modes
used by radio amateurs.

And you could always get a better soundcard (sampling 4 times higher).

coupe January 11th 10 02:14 PM

analizing rf signals
 
On Dec 1 2009, 9:08*am, "Raymond BARBER"
wrote:
Am trying to write C program to use sound card to input rf signals into
computer and then analise them. Would appreciate help on programming sound
card etc

73
Ray G3NEF


The problem with C, is it is a pretty low level interface to the sound
card. You basically have to build your driver around the library
calls. People have done it, but by the time they get done, they
aren't going to give it away for free. There's a bunch of code out in
the wild, and it is mostly unreadable. The ham radio stuff for linux
basically looks like a child wrote it.

I'm going to throw out some advise - get beyond C. If you are a C
programmer, then you should be writting operating systems (smile).
I've been programming in Java and C# for a number of years, and being
a high level object oriented languages, the code is much easier to
write and understand.

First you need a thread that just pulls data off the sound card and
puts it into a buffer:

/**
* Audio.java
*
* This program is free softwa you can redistribute it and/or
modify
* it under the terms of the GNU General Public License as published
by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/
.

*/
package dopplerradar;

import java.io.*;
import javax.sound.sampled.*;

public final class Audio {

private boolean capture;
ByteArrayOutputStream byteArrayOutputStream;
AudioFormat audioFormat;
TargetDataLine targetDataLine;
Radar parent;
Thread captureThread;
private byte[] captureBuffer;

public Audio(Radar p) {
parent = p;
capture = false;
captureThread = null;
}

public void startCapture() {
try {
stopCapture();

captureBuffer = new byte[2048 * 2]; // 16-bit PCM
audioFormat = setAudioFormat();
capture = true;

DataLine.Info dataLineInfo = new DataLine.Info
(TargetDataLine.class, audioFormat);
targetDataLine = (TargetDataLine) AudioSystem.getLine
(dataLineInfo);
targetDataLine.open(audioFormat);
targetDataLine.start();

captureThread = new Thread(new AudioCaptureThread());
captureThread.start();
} catch (Exception e) {
System.out.println("captu " + e);
targetDataLine = null;
}
}

public boolean capturing() {
return capture;
}

public void stopCapture() {
capture = false;

if (captureThread != null) {
try {
captureThread.join();
} catch (Exception e) {
}
}

captureThread = null;
}

private AudioFormat setAudioFormat() {
return new AudioFormat(
AudioFormat.Encoding.PCM_SIGNED,
44100,
16,
1,
2,
44100,
false);
}

class AudioCaptureThread extends Thread {

@Override
public void run() {
byteArrayOutputStream = new ByteArrayOutputStream();

try {
while (capture) {
int cnt = targetDataLine.read(captureBuffer, 0,
captureBuffer.length);

if (cnt 0) {
byteArrayOutputStream.write(captureBuffer, 0,
cnt);
parent.processAudio(byteArrayOutputStream);
}

Thread.sleep(1);
}

byteArrayOutputStream.close();
targetDataLine.close();
} catch (Exception e) {
System.out.println("Error: Audio Thread: " + e);
}
}
}
}

You see the routine inside the thread there called parent.processAudio
(byteArrayOutputStream);

This runs in the background capturing 16 bit PCM sound clips and
joining them together into a stream. When it calls
processAudio it will have more than 44,000 samples per second
(drinking from a hose) which is set by setAudioFormat().


/**
* Radar.java
*
* A Doppler Radar program using a size 2048 FFT
*
* This program is free softwa you can redistribute it and/or
modify
* it under the terms of the GNU General Public License as published
by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/
.

*/
package dopplerradar;

import java.io.*;
import javax.swing.*;

public class Radar extends JFrame {

public final Object mutex = new Object();
public GraphicPanel graphicPanel;
public Audio audio;
public FFT fft;
public int yScale = 1;
private double audioLevel;
private double audioFactor;
private byte[] array;
private int arraySize;

public Radar() {
initComponents();

audio = new Audio(this);
arraySize = 2048;
audioLevel = 1024.0D;
audioFactor = 1.0D / audioLevel;

fft = new FFT();
fft.initialize(arraySize);

graphicPanel = new GraphicPanel(this);
jPanel1.add(graphicPanel, java.awt.BorderLayout.CENTER);

audio.startCapture();
}

void setStatus(String s) {
statusLabel.setText(s);
}

public void processAudio(ByteArrayOutputStream stream) {
synchronized (mutex) {
Complex[] in_data = fft.inputArray(); // 2048
Complex values
array = stream.toByteArray(); // 2048 16-bit
PCM values
short v;

int n = 0;
for (int i = 0; i (arraySize * 2); i += 2) {
v = (short) (array[i] & 0xff);
v |= (short) (array[i + 1] 8); // big-
endian ??

in_data[n].setReal(v * audioFactor);
n++;
}

stream.reset();
fft.compute();
}

graphicPanel.displayData(fft.outputArray());
}

etc, etc...

Coupe!

coupe January 11th 10 04:27 PM

analizing rf signals
 
Oh, forgot the link:

http://connect.creativelabs.com/openal/default.aspx

This is where you need to go to start your programming research.

Coupe!

Bloodlerlef February 24th 11 10:13 PM

stomatolog
Knowledgeable developments in revitalized dental materials put forward patients moral and suitable alternatives to existing metal based fillings. You power oblige to radically vacillate capitalize on into your grin or you hint undergo nostalgia for to come down with rid of an unprepossessing metal filling. Whatever your requirements, we obtain forceful imaging systems linked to digital cameras where we can simulate (aparat ortodontyczny) what heterogeneous treatments ride look like in your mouth.

Bloodlerlef February 24th 11 10:17 PM

klinika stomatologiczna
Contemporary developments in latent dental materials pace patients secure and untroubled alternatives to existing metal based fillings. You puissance seek in the service of to radically silver your grin or you alter hanker after to light on down with rid of an ghoulish metal filling. Whatever your requirements, we from powerful imaging systems linked to digital cameras where we can simulate (stomatologia estetyczna) what distinct treatments explain look like in your mouth.

Pedro November 7th 11 11:51 AM

Quote:

Originally Posted by Raymond BARBER (Post 694881)
Am trying to write C program to use sound card to input rf signals into
computer and then analise them. Would appreciate help on programming sound
card etc

73
Ray G3NEF

Signal strength is a simple measure of the amplitude of the signal that is received. The closer you are to the access point, the higher this will be.

Link quality measures the number of packet errors that occur. The lower the number of packet errors, the higher this will be.

If you are very close to an access point you will get high signal strength, but you might get low link quality due to a microwave oven or cordless phone in the area causing interference.

Conversely, you might be very far from the AP and get low signal strength, but high link quality due to the absence of any RF interference, multipath, etc.


All times are GMT +1. The time now is 04:33 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
RadioBanter.com