AN3143 Audio Software Codec for STM8S Application Note

This application note describes a simple and easy-to-use solution to help design and develop products with an audio output, for example, toys, white goods, washing machines, and alarms. Audio data generally require the storage of a lot of memory. However, the memory space needed to preserve such data can be reduced by compressing the audio data via a specified compression method. Processing these data is a complex task requiring powerful microcontrollers such as DSP or audio chip. Usually, 8-bit microcontrolles do not offer either a large memory or a high computing performance. The software solution offered in this application note reconstructs audio signals from compressed samples. A simple audio codec based on an adaptive differential pulse coded modulation (ADPCM) algorithm is used and advantage is taken of the advanced STM8S core with its 3-staged pipeline and 16 or 24 MIPS peak performance. The digital samples are usually converted to an analog signal by some external or onchip digital-to-analog converter (DAC). There are a lot of applications where the high fidelity audio output is not a priority and/or the use of an external DAC is not a suitable cost- effective solution for 8-bit microcontrollers. To reduce costs and to offer a good quality audio, an ideal solution is to generate an audio signal using pulse width modulation (PWM).


AN3143 Audio Software Codec for STM8S Application Note - cover page
Brand
STMicroelectronics
Document type
Application Note
Language
English
Pages
13
File format
PDF
File size
251 KB
Published
07 August, 2012
Updated
30 September, 2023
Model
STM8S
MD5 checksum
308E079FF23CC7BF9CB5422EE439AEAD

About this manual

This document presents a software-based audio codec solution designed for 8-bit microcontrollers, specifically targeting the STM8S family. It details the implementation of an Adaptive Differential Pulse Code Modulation (ADPCM) algorithm to reconstruct audio signals from compressed samples without requiring external Digital-to-Analog Converters (DACs). The approach utilizes Pulse Width Modulation (PWM) to generate high-quality audio output suitable for applications like toys, alarms, and white goods.

The note covers the IMA ADPCM codec standards, including decompression and compression algorithms. It provides guidance on storing encoded audio data in internal Flash memory or external memory using raw bitstreams. Additionally, it explains how to integrate audio data arrays into compiled code via HEX editors and compiler directives.

What's inside

  • ADPCM Codec
  • IMA ADPCM Decompression
  • IMA ADPCM Compression
  • Audio Data Encoding
  • Internal Flash Memory Storage
  • External Memory Usage

Frequently asked questions

What types of products can use this audio codec solution?

This solution is designed for products such as toys, white goods, washing machines, and alarms.

What is the target sample rate for the example command?

The example command resamples the input audio data to a target frequency of 15625 Hz.

How much memory is required for a 5-second audio bitstream at 8-kHz?

A 5-second ADPCM bitstream with an 8-kHz sample rate uses 20 Kbytes of memory.

Download PDF (251 KB)

More STMicroelectronics Manuals


View all STMicroelectronics manuals →