A Simple VLF Receiver Program

rxvlf: A Linux/Unix program to filter, record and stream, VLF radio signals via the soundcard. This is a non-interactive program, configured by command line options, which is intended to run as a daemon program for continuous reception of natural radio signals in the audio frequency range.

Updated: 24 Jan 2010

Description

This program:

Download

The current version, 0.91, is available for downloaded here: rxvlf-0.91.tar.gz.

Limitations

Installation

You'll need the following prerequisite packages and any dependencies they may require. These are all mature packages which should install with no problems. Further down this document are some suggestions for installing these. Before building rxvlf, you will probably want to alter some of the compiled-in configuration options, see below.

Configuration

There are some definitions in rxvlf.c that you might want to customise before compiling.

RAWPATH is the directory into which rxvlf will write daily files of raw PCM, as well as daily (ASCII) log files of RMS signal levels and events. On my system this is a mountpoint for a 150G drive. If this directory doesn't exist, rxvlf will try to create it. If streaming is enabled, the ices log file will also go in here.

#define RAWPATH      "/raw"

LOG_INTERVAL specifies how often (integer seconds) a message reporting rms and peak signals will be recorded to the current log file. This determines the integration time of the RMS.

#define LOG_INTERVAL  5  

Probably the only one you'll want to alter to begin with is RAWPATH.

Compiling

Unpack the downloaded tar.gz file and compile with the following shell commands

tar xzf rxvlf-0.91.tar.gz
cd rxvlf-0.91
./configure
make

You can then run the program from within this directory, with

./rxvlf

or you can run make install to place rxvlf into /usr/local/bin. Run ./configure --help for the options which specify alternative locations.

The configuration script will try to use ALSA sound drivers if they are present on your system, otherwise it will fall back to OSS.

Running

A minimal start command is just

rxvlf -rd 1

which will run the receiver at 32k sample rate, mono (left only) and the signal will be recorded in raw PCM files (see further below). MP3 encoding or stream uplinking will not be activated.

To run with the auto-notch hum removal, use

rxvlf -rd 1 -an 1

Tailing todays log file (/raw directory) should give you records like

20080713 185911 rms 0.0423 0.0004   max 0.7088 0.0025

This example shows left RMS = 0.0423 and left peaking at 0.7088. The right channel, with no input, just reports the soundcard background noise.

Streaming

To activate streaming, apply to rxvlf0807@abelian.org for a stream mountpoint and uplink password. Put these on the command line, along with a -mc option, for example

rxvlf -rd 1 -an 1 -mc 1 -sm /vlf99 \
       -sp dummy_password -sn 'My new VLF stream' \
       -sd 'My stream description'

From another terminal, check the process table (ps axf) and look for something like

24732 ?   S    6:04 rxvlf -rd 1 -mc 1 -sm /vlf99 -sp dummy_password 
24733 ?   S    0:00  \_ ices -c rxvlf.ices.conf
24734 ?   S    2:45  \_ lame -r -s 32.000 -b64 -mm - rxvlf.fifo

which shows rxvlf running with two child processes, ices and lame.

Open a browser on http://67.207.143.181/ and look for your stream.

Running in background

Once you've got rxvlf running happily, it's a good idea to restart it in background so that the service is not interrupted when you exit your terminal. Add a -D option to the command line.

Command Line Options

There is no config file for rxvlf - all the runtime options are on the command line. The command line will get quite long so put all your favourite options into a wrapper script.

General options

These options should be given on the command line ahead of any filtering or streaming options.
 -D                 Detach from the terminal and run as a daemon.
                    Default is to remain in foreground with log messages
                    to stderr.

 -d device          Specify the soundcard device name
                    Example: -d hw:0,0      (default for ALSA)
                             -d /dev/dsp    (default for OSS)

 -cm mode           Soundcard capture mode
                       -cm 1      Mono
                       -cm 2      Stereo (default)

 -rd chans          Determine which of the left/right soundcard channels are
                    to be recorded into raw PCM daily files.
                       -rd 0      No raw recording   (default)
                       -rd 1      Left only
                       -rd 2      Right only
                       -rd 3      Left and right

 -r rate            Set soundcard sample rate, in Hertz, which will also
                    determine the sample rate of the raw PCM files.
                    Example: -r 32000   (default)

Automatic notch filter options

The notch filter is only applied to the streamed copy of the signal and does not affect the recorded raw data.

 -an chans          Enable auto-notch for hum removal on selected channels,
                       -an 0      Auto notch off  (default)
                       -an 1      Enable left only
                       -an 2      Enable right only
                       -an 3      Enable both channels

 -af factor         Auto-notch threshold.  An offending bin must exceed this
                    factor times the average of its neighbours in order to
                    activate a notch.
                    Example: -af 8.0  (default)

 -ab bins           Half-width of the auto notches, in bins.  
                    Example: -ab 2   (default)
                    Produces auto notches 5 bins wide.  The width in Hertz
                    will be 
                       (1 + 2 * bins) * sample_rate/IPFN 
                    where IPFN is the defined FFT frame size of the filter.
                    The value 2 is a good one to use.  Try to make this as
                    small as possible (minimal ringing) consistent with
                    cutting out all the hum.

 -am factor         Skip updating of auto-notch average bin powers if the total
                    energy in the filter's FFT frame is higher than the recent
                    average power by this factor.
                    Example: -am 2.0   (default)

Other filter options

These options only affect the streamed copy of the signal, not the recorded raw data.

 -blk chans list    Specifies a list of frequency blocks to be filtered out.
                    chans determines which channels to apply the block to,
                          left=1, right=2, both=3.
                    list is a comma separated list of ranges to block.
                    Example: -blk 3 17980-18230,18750-22049
                             Blocks 17.98kHz to 18.23kHz and 18.75kHz to 22.049kHz
                    You can supply multiple -blk options.

 -lpf poles corner  Apply a low pass filter with the given number of poles
                    and corner frequency.
                    Example: -lpf 2 12000     12dB/octave, 12kHz corner
                    You can put in as many lpf options as you need.

 -hpf poles corner  As above, high pass filter
                    Example: -hpf 4 600
                  
 -xl hertz          Translate the frequency down.  Translation is done after 
                    all the other filtering options have been applied.

MP3 encoding options

 -g factor          Output gain factor which is applied to the mp3 stream
                    and the logged rms and peak readings, but not the
                    raw PCM files.  This is an amplitude gain factor, not
                    a dB level, so -g 0.5 means -6dB and -g 10.0 means
                    +20dB, etc.
                    Example: -g 1.0   (default)

 -mc chans          Enable mp3 streaming of the specified channels.  This also
                    activates ices to uplink the mp3 stream to the server.
                       -mc 0    No mp3 streaming   (default)
                       -mc 1    Mono stream from left channel
                       -mc 2    Mono stream from right channel
                       -mc 3    Stereo stream

 -mr rate           Specify mp3 sample rate
                    Example:  -mr 44100      Set to 44.1k samples/sec.
                    Default is to use the same sample rate as the soundcard.

 -mb kbps           Sets the mp3 stream's constant bitrate in kbps.
                    Example:  -mb 64   (default 64kbps)
                    Legal values are  
                      8, 16, 24, 32, 40, 48, 56, 64, 80, 96, 112, 128, 144, 160 
                    Usually, 64 is fine for mono VLF signals, 128 for stereo.

Stream uplink options

Note: Streaming to the server will only occur if a non-zero -mc option is given. By default, streaming is off and the program just records raw PCM.

 -ss server         Specify the server to connect to, and a port number if
                    necessary.
                    Example:  -ss 67.207.143.181  (default server and port 80)
                              -ss my_server:8080  (port 8080)
                 
 -sp passwd         This password is passed on to ices to gain stream uplink
                    access to the server.

 -sm mountpoint     Specify the mountpoint to use on the server.  Must begin
                    with a slash and contain no spaces.
                    Example: -sm /test    (default)

 -sm mountname      The name by which the stream identifies itself on the server.
                    Example: -sn "VLF E-Field, Todmorden, UK"
                    Note the name needs to be quoted.  Default is "VLF test".

 -sd description    Short (quoted) description of the stream which is passed up
                    to the server.
                    Example -sd "E-field receiver at 53.703N 2.072W"
                    Default is "VLF stream test"

 -su URL            The URL of your website
                    Example: -su "http://abelian.org/vlf/"  (default)
                    Your stream will be listed on abelian.org anyway.

Mixer

rxvlf does not do anything with the mixer. It's up to you to run a mixer program to select the recording source and capture gain. Adjust the capture gain while tailing the log file and set the gain so that the max indication is peaking somewhere above 0.5 but keeping below 1.0 to avoid clipping. With the typical dynamic range of VLF signals, the RMS will then be perhaps only 0.03 or so.

Raw PCM Files

Given a -rd option the program will record the received channel(s) in raw PCM signed 16 bit mono samples - separate files for left and right.

File names have the format yyyymmdd-HHMMSS_rrrrr.c where yyyymmdd is the date, HHMMSS is the start time, rrrrr is the sample rate and c is the channel: 1=left, 2=right.

For example the raw file

  20080522-220531_32000.1

was started on 22nd May 2008 at 22:05:31 containing data from left channel at 32k samples/sec.

Installation Tips

fftw3

Download the source tar file from http://www.fftw.org/.

Suppose you have downloaded fftw3_3.0.1.tar.gz Build with the following shell commands:-

tar xzf fftw3_3.0.1.tar.gz
cd fftw3_3.0.1
./configure
make
make install

ices

Download ices-0.4.tar.gz from http://www.icecast.org/ices.php and build with

tar xzf ices-0.4.tar.gz
cd ices-0.4
./configure
make
make install

lame

Download the source tar file from http://lame.sourceforge.net/. Suppose you have downloaded lame-3.98b6.tar.gz, build with

tar xzf lame-3.98b6.tar.gz
cd lame-3.98b6
./configure
make
make install

Miscellaneous Notes