This application note describes a simple and easy-to-use solution to help design and
develop products with an audio output, for example, toys, alarms, door bells, and white
goods.
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 usually a complex task requiring
powerful microcontrollers such as DSP or audio chip. Normally, 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 STM8L
core with its 3-staged pipeline and 16 MIPS peak performance.
The digital samples are converted to an analog signal by an on-chip, 12-bit, digital-to-analog
converter (DAC). This offers good overall audio quality, yet is a cost-effective solution for 8bit microcontroller applications.
The battery-powered application benefits from the ultra low-power consumption of STM8L
microcontrollers.
The example firmware and application hardware design are provided with this application
note to enable easy porting of the offered solution to the final application.
ADPCM is a fixed length codeword audio codec which reduces redundant information from
audio waveforms. The information core is separated from the correlated waveform samples
by encoding differences between the current samples and the predicted ones. As the
correlation between consecutive audio samples is generally high, this method is reasonably
effective and preserves good audio quality. The ADPCM codec, which is based on coding
waveforms in time domains, is much less complex than codecs based on voice perception
(vocoders) that operate in frequency domains. For these reasons, the ADPCM codec is the
best choice for the audio output on 8-bit microcontrollers.
The ADPCM algorithm has been developed for speech coding. It is implemented in several
steps and is used in telephone systems like ITU-T G.726 (covering CCITT G.721 and G.723
standards). G.726 and similar telecommunication codecs, offer several advanced features
which are necessary for successful transmission and streaming. Such features include
synchronous coding adjustment, tone detection to carry data modem signals, adaptated
speed control, and recovery from transmission error conditions. These features lead to
additional algorithm complexity which either requires the use of a digital signal processor
(DSP) or lowering the encoding/decoding sample rate. Such features do not bring many
additional benefits to the microcontroller for coding/decoding the audio or speech signals.
Less complex alternatives can be found.
1.2 Interactive multimedia association (IMA) ADPCM
The IMA
different computers platforms, for example in Microsoft® Sound Recorder or Apple®
QuickTime® player. It was originally offered by Intel/DVI® as an open standard for use by
the IMA. The reference algorithms and recommended formats were initially developed by
the digital audio technical working group (DATWG) and refined by the digital audio focus
group (DAFG) of the IMA. These groups are no longer active.
The IMA DATWG reference algorithm is less complex than the G.726 algorithm. The number
of encoding/decoding CPU cycles needed is reduced by using fixed prediction and by
replacing complex floating point mathematical operations by look-up tables. The
implementation of the ADPCM codec presented in this application note is compatible with
the IMA reference algorithm published by the IMA DATWG/DAFG in the “Recommended
Practices for Enhancing Digital Audio Compatibility in Multimedia Systems”, revision 3.00
(see References).
(a)
ADPCM codec is one such alternative solution. This codec is widely used across
a. IMA is a computer/audio/video industry trade association that has worked to promote multimedia application
development.
Doc ID 17566 Rev 23/13
ADPCM codecAN3225
3
Q
3
D
3
,
3
P
Q
)NVERSEQUANTIZER
0REDICTOR3TEPSIZEADAPTOR
AI
1.3 IMA ADPCM decompression
The IMA ADPCM decompression algorithm compresses samples which are stored as 4-bit
signed two’s complement values. The result is decompressed samples in linear 16-bit two’s
complement format.
The input sample (S
obtain a difference (S
) is dequantized using an inverse quantizer with an adapted step (q) to
q
). The step size is adapted by using a lookup table approximating to
d
an exponential function. The vector pointing to the lookup table is adjusted according to the
magnitude of S
subtracted to S
predicted sample (S
previous output value. The decoder preconditions are that S
. To reduce quantization errors, one half of the step size is always added or
q
. The resulting decompressed linear sample is the sum of Sd and the
d
). As Sp is a simple zero order hold function, Sd is simply added to the
p
is cleared and that the
p
quantization step is set to the smallest one.
Figure 1.ADPCM decoder
4/13Doc ID 17566 Rev 2
Loading...
+ 9 hidden pages
You need points to download manuals.
1 point = 1 manual.
You can buy points or you can get point for every manual you upload.