spandsp: Line echo cancellation for modems tests

spandsp 0.0.6

Line echo cancellation for modems tests

# What does it do?

Currently the echo cancellation tests only provide simple exercising of the cancellor in the way it might be used for line echo cancellation. The test code is in echotests.c.

The goal is to test the echo cancellor again the G.16X specs. Clearly, that also means the goal for the cancellor itself is to comply with those specs. Right now, the only aspect of these tests implemented is the line impulse response models in g168tests.c.

# How does it work?

The current test consists of feeding an audio file of real speech to the echo cancellor as the transmit signal. A very simple model of a telephone line is used to simulate a simple echo from the transmit signal. A second audio file of real speech is also used to simulate a signal received form the far end of the line. This is gated so it is only placed for one second every 10 seconds, simulating the double talk condition. The resulting echo cancelled signal can either be store in a file for further analysis, or played back as the data is processed.

A number of modified versions of this test have been performed. The signal level of the two speech sources has been varied. Several simple models of the telephone line have been used. Although the current cancellor design has known limitations, it seems stable for all these test conditions. No instability has been observed in the current version due to arithmetic overflow when the speech is very loud (with earlier versions, well, ....:) ). The lack of saturating arithmetic in general purpose CPUs is a huge disadvantage here, as software saturation logic would cause a major slow down. Floating point would be good, but is not usable in the Linux kernel. Anyway, the bottom line seems to be the current design is genuinely useful, if imperfect.

# How does it work?

Build the tests with the command "./build". Currently there is no proper make setup, or way to build individual tests. "./build" will built all the tests which currently exist for the DSP functions. The echo cancellation test assumes there are two audio files containing mono, 16 bit signed PCM speech data, sampled at 8kHz. These should be called local_sound.wav and far_sound.wav. A third wave file will be produced. This very crudely starts with the first 256 bytes from the local_sound.wav file, followed by the results of the echo cancellation. The resulting audio is also played to the /dev/dsp device. A printf near the end of echo_tests.c is commented out with a #if. If this is enabled, detailed information about the results of the echo cancellation will be written to stdout. By saving this into a file, Grace (recommended), GnuPlot, or some other plotting package may be used to graphically display the functioning of the cancellor.