Simple Compression

Since the performance issues were not finalized until the last development stage of RealVoice, SimpleCompression class was implemented. While the bandwidth of RealVoice does not require use of SimpleCompression, this class provides an easy-to-use and time efficient compression functionality.

Algorithm

User specifies compression rate cr in the compression call. Then, first cr buffer elements are averaged and the result is stored in the first element of the same buffer. This procedure is repeated for second cr elements (the result is stored in the second buffer element) and so on. Thus, the compression is completed in-place. On, decompression, a reverse operation-- "streching out of the buffer"-- is performed. The difference between two adjacent buffer elements is calculated. This difference is then interpolated over dr (decompresion rate) elements in the decompressed buffer.

Performance

The following test was performed: some data was read from the mocrophone; it was then compressed, decompressed, and outputed to the speakers. The test was performed both in real time and with delay.
Reasonable quality of the sound was produced with compression/decompression rate 2. When greater rates were used, the outout resembled computer-like voice (rates greater than 4 produced sound of very poor quality).

Usability

Simple Compression can be useful in applications which tolerate low sound quality and/or require fast processing of data.