Implementation

C++

At first I wrote programs in plain C but I found that it is better to implement DSP elements such as filter, hilbert transformer, and delay as 'classes' in C++.

Current implementation does not use an independent Hilbert transformer and a 'delay'. Instead a pair of band-pass filters are used. I/Q signal are passed through one of those BPF respectively. Two filters have identical frequency(amplitude) response but the phase response of the Q channel BPF is 90 degree different with respect to I channel BPF. If you want to konw further details of such filters, see references.

All the filters in the program are FIR type and have the following characteristics.

BPF:

  Sampling Rate: 12000Hz
  Number of taps: 89
  Passband: 300-3000Hz
  Transition band: 500Hz
  Stopband attenuation: 60.0 dB

Decimation/Interpolation LPF:  

  Sampling Rate: 48000Hz
  Number of taps: 89
  Passband: 0-4000Hz
  Transition band: 2000Hz
  Stopband attenuation: 60.0 dB

They were designed by using Java applets found on the Internet (example of filter design).

The ALSA sound driver seems to be in the rapid development process. While I was writing the demodulation program the API changed extensively (version 0.4.x to 0.5.x). My DSP program dosen't run with newer API. I hope I will make my codes compatible with new API soon.

Java

I first considered Java programming language for creating GUI for the DSP program. But when I looked into SUN's Java site I found that there was a Java Sound API and thought that it might be possible to write whole program in Java.

The current Java Sound API cannot open capture and playback device with different format (sampling rate). So the demodulator program must perform interpolation (to 48kHz) after it gets the demodulated AF signal. The generator program must sample mic input at 48kHz and decimate it to 12kHz at first.

The program consists of following 5 files(classes).

They are far from complete and I cut corners in various places. The program runs with JDK1.3(or higher) on Windows but not on Linux because of the bugs in JDK sound API(at this point in time -- Aug 2000).

The program is provided "as is" without any warranty of any kind.

Running the program

You need First install JDK. You can download it from java.sun.com. Instllation is relatively easy.

Next make a directory where you will put DSP programs ('c:\dsp' for example). Under that directory, make 2 directories named 'src' and 'classes' respectively. Then copy 5 source files into the 'src' directory.

Set CLASSPATH variable:

set CLASSPATH=%CLASSPATH%;c:\dsp\classes;
Compile dsp programs:
cd c:\dsp (the top directory you made for dsp programs)
cd src
javac -d ..\classes *.java
Now you are ready. To run the generator program, type
java ji3gab.dsp.Generator 1
or to run the demodulator program, type
java ji3gab.dsp.Detector 1
'1' is an argument for the program and it corresponds to mode. '0' for AM(demodulation only), '1' for LSB, and '2' for USB.

You may need to adjust various sound levels such as MIC, LINE IN, Wave output, Master, etc. through Windows' audio property panel.