Python Scripts for Amateur Radio

Hi all, here are some simple Python scripts for amateur radio audio applications which I recently wrote, and which can be used as a basis of own experiments, or for teaching purposes. You simply start them in a linux command shell (or any shell which has python) with: python name.py They all use the default audio port 0, if another port is desired, just edit the script correspondingly (in p.open, for instance: "input_device_index=1"). You can obtain a smaller bandwidth, for instance for the waterfall diagram, by reducing the sampling rate, for instance to "RATE=16000" for a 8kHz bandwidth for the display (the possible sample rates depend on the sound card used). You need to have python-pyaudio and python-opencv installed (in Linux you sinply type: sudo apt-get install python-pyaudio python-opengl).

They are:

-pyrecspecwaterfall.py

A spectrum waterfall animation of the audio signal, for instance for monitoring the radio signal or the microphone signal,

-pyrecspectrum_animation.py

A real time audio spectrum plot, for instance to monitor the microphone signal,

-pyrecplotanimation.py

A real time audio "oscilloscope", which plots the audio waveform in real time, again e.g. for monitoring the microphone signal. The variable CHUNK sets the time width of the display in samples,

-pyreclogspectrum_animation.py

the same as above, but with a logarithmic frequency axis, achieved by insterting the line: ax.set_xscale('log'),

-pyrecplay_loglimiterblockbar.py

An audio compressor with corresponding power bar to increase the average achived power output by compressing the audio (microphone) signal with a logarithmic curve. You can put it on a little netbook, or perhaps a Raspberry Pi or such, between the microphone and the transceiver input. It doesn't sound as nice as an Orban compressor, but gives you a real "battle" modulation :-). The moving bar shows you how much output you are generating.

-gsaudiocompressor.py

An improved audio cpmpressor, with and additional peak power bar (in red) and key control:

keys "+" and "-": adjustable compression for compression strength "1" to "255".

key "c" : The compression can be switched on and off

key "q" : Quit

If the green, average power bar is longer than the red instanteneous power bar this means that the signal is non-sinusoidal and more compressed, with similarity to a rectangular wave. Observe that the keys are only active if the compressor window is active.

Have fun tinkering with it, 73, Gerald, DL5BBN

pyrecplotanimation.py

pyrecspectrum animation.py

pyreclogspectrum animation.py

pyrecspecwaterfall.py

pyrecplay loglimiterblockbar.py

gsaudiocompressor.py