SLAA361A July   2007  – August 2018 MSP430F169 , MSP430F169 , MSP430FG4618 , MSP430FG4618

 

  1.   Speech and Sound Compression and Decompression With MSP430™ MCUs
    1.     Trademarks
    2. 1 Introduction
    3. 2 Compression and Decompression Algorithms
      1. 2.1 Differential Pulse Code Modulation (DPCM)
      2. 2.2 Adaptive Differential Pulse Code Modulation (ADPCM)
    4. 3 Signal Chain on Chip in MSP430 MCUs
      1. 3.1 MSP430F169 Signal-Chain-on-Chip Solution
      2. 3.2 MSP430FG4618 Signal-Chain-on-Chip Solution
    5. 4 Performance on the MSP430 MCUs
      1. 4.1 Using the Associated Code
    6. 5 References
  2.   Revision History

Using the Associated Code

The associated code includes two software projects. These two versions are based on the descriptions in Section 3, and both use the IMA ADPCM algorithm.

The use of the ADPCM functions is simple. First, ADPCM.h must be included in the application code. This header file declares the ADPCM functions of the ADPCM.c file. Before each sequence of recording or replaying audio data, the ADPCM_Init() function must be called. This function defines the start values for the signal estimate (Se) and the step size pointer that is used for the quantizer step size adaptation. The encoder and decoder are synchronized by these settings. Encoding is realized by calling the ADPCM_Encoder(int value) function, and playback is realized by calling ADPCM_Decoder() for each audio sample. The following code segment shows how this could be done.

#include "ADPCM.h" void main(void) { // initialization of application software while(1) // Main Loop { // application software if (P1IN & 0x01) record(); if (P1IN & 0x02) play(); } } void record(void) { // initialization for recording (ADC, timer, amplifier, ...) ADPCM_Init(); // this is done before recording is started // start recording } void play(void) { // initialization for recording (DAC, timer, amplifier, ...) ADPCM_Init(); // this is done before playback is started // start playback }

The following measurements of the ADPCM function execution times were made with IAR Embedded Workbench® KickStart version 3.42A. The default optimization settings were used for the measurements.

ADPCM_Encoder() function call requires between 114 and 126 cycles.

ADPCM_Decoder() function call requires between 99 and 109 cycles.

These measurements include only the compression and decompression algorithms. Algorithms to record and play require additional code.