Testing Codec 2 Algorithms

Codec 2 uses a sinusoidal model to represent speech signals. Parameters include the amplitudes and phase of each speech harmonic. To send the amplitudes over the channel I use a LPC model. To save bits I don’t any phase information at all. Instead, the harmonic phases are generated at the decoder using a rule based algorithm.

The speech quality of the baseline sinusoidal model (using original harmonic amplitudes and phase) is very good. I call this the unquantised codec:

As LPC and phase modelling is introduced, the speech quality slowly degrades.

To experiment with the codec I have a simulation program (c2sim), that can be used to process speech with the various Codec 2 algorithms switched off or on. For example I can listen to speech with original amplitudes but phases generated by the phase model. Or LPC modelled amplitudes, but original phases.

Here is a block diagram of the codec using original amplitudes but the synthetic phase model:

And here is a block diagram of original phases but amplitudes extracted from an LPC model:

Listening to the various algorithms in isolation allows the effect of each procesing step to be understood and debugged. It’s a bit like unit testing, except you judge the result with your ears.

Typical processing steps are:

  1. original speech sample
  2. unquantised sinusoidal codec
  3. phase modelling
  4. LPC amplitude modelling
  5. phase modelling and LPC amplitude modelling
  6. phase modelling and LPC amplitude modelling and decimated to 20ms

The fully quantised codec used in the real world would have all processing steps running (LPC amplitude, phase model, decimation, LPC quantisation with LSPs).

The sim.sh script generates these automatically and listensim.sh presents a menu to play the samples:
david@bear:~$ cd codec2/src/
david@bear:~/codec2/src$ ./sim.sh hts1a
SNR av = 9.62 dB
SNR av = 9.62 dB
SNR av = 9.62 dB
david@bear:~/codec2/src$ ./listensim.sh hts1a
Q-Quit
1-../raw/hts1a.raw
2-hts1a_uq.raw
3-hts1a_phase0.raw
4-hts1a_lpc10.raw
5-hts1a_phase0_lpc10.raw
6-hts1a_phase0_lpc10_dec.raw