Moose The Chocolate Wave


Moose the Chocolate Wave is a program to convert from audio to morse (or CW) to text. The theory of operation is explained briefly below, as well as example output, code, and so on. If you are interested in using this program, please contact me, and I can work out some of the deficencies. The program works perfectly for what it does, but it needs more field testing and user feedback!

Primarily the featureset should be extended to be more of a usuable application to ham's, and less of a pet project. Ideally, morse logging would occur, and maybe storage of the original wave compressed. Fedback would be in more of a real time fashion than in chunks. It also needs testing and tweaking. It makes a frequency guess, and tracks well, however it can make bad mistakes. For instance, choosing the wrong harmonic (especially distortion overtones).

Direct interest in the program to bear at yikes.com

Usage

Note: MTCW requires libfftw3 to compile.
       libfftw3 is a library to do Fast Fourier Transforms

Input to the program can be done in two ways. In either case, input is 8 bit/sample single channl audio data. The sample rate should be fast enough to get around 4 chunks (1024 samples) per short (dit), but not too fast that the corresponding frequency would be near dc. A good range is from about 8-20Khz. Input can either be a file or through the PCM (UNIX) interface. The input interface is crude, and requires recompiling to change the source. By default, the program tries to open a file called 'potato.huff'. The file must consist of 8 bit single channel headerless data, and can be created by using mplayer. For instance, mplayer -ao pcm -aop format=16 -channels 1 -nowaveheader <audio input> will produce the correct data.

Output consists of the three parts. The spectral analysis of the stream (based on the variable guess), the corresponding morse code, and then the conversion to text. An example is shown below. Original audio stream is morse.wav, program output is below:

guess is 46
0000111111110011100111111111001111000000001111111100111111111001
1110011111111100000000000000000011111111100011100111000000001110
0000000000000000001110011111111100111111111001110000000011110011
1111111001111111110011111111100000001111111110011110011111111100
1110000000000000000000111111110001111111110011110111111111000000
0011100111100111000000001111111100011000111000111111110000000000
0000000001111111110011100011100111001111000000001111111100011100
1110001111111100111100000001111111110001111111110111111111001111


 [-.-. --.- -.. . .--. .--- -.-. --.- ... -..- -.... -..-. ---]
cqdepjcqsx6/o


0001111100000000000000000111111111001111111100000000111000111001
1110011110000000111111111001111111110011100111000000000000000000
01111111110011100011111111000000000000

 [ . -- .... --.. -.-]
emhzk

The number guess refers to the frequency reletive to a sample size of 256. The number can be extrapolated to relate to Hz.

Download

The source, and theory of operation can be downloaded from this site. In particular, look at the file fft.c in the fft.tar.gz archive.

Other

Morse the chocolate wave should be able to run on any computer capable of compiling the executable. I.E. 486 w/ 8megs of ram, not that I would want to *try* compiling it on my 486 ;). I would like to make a version that works on the ATmega series of microcontrollers, though I doubt I would ever have a reason to do that.

To give an idea of the speed, Initializing the fft library takes about half a second, and running my program with 170,000 samples takes about half a second (Running on a 600Mhz TM5600, usually clocked at 300Mhz). Presumably, this means a running time of about a tenth of a second for 170,000 samples (which corresponds to about 10 seconds of audio).

Doing a Fast Fourier Transform in the first place to determine spectral content may be overkill. Especially considering that the library is based on a floating point library, and we are using 8 bit integers. On the other hand, doing digital filtering may prove to be cumbersome as well.