AN2812 - Vocoder demonstration using a Speex audio codec on STM32F101xx and STM32F103xx microcontrollers.pdf

(259 KB) Pobierz
Vocoder demonstration using a Speex audio codec on STM32F101xx and STM32F103xx microcontrollers
AN2812
Application note
Vocoder demonstration using a Speex audio codec
on STM32F101xx and STM32F103xx microcontrollers
Introduction
This application note describes how to implement the codec Speex software on the
STM32F101xx and STM32F103xx microcontrollers to build a vocoder application.
Speex is a free audio codec dedicated to speech encoding and decoding. It provides a high
level of compression with a good quality of sound. That makes it a high-performance
solution for any application using message playback or a voice recorder, like answering
machines, building and home safety systems, intercoms, smart appliances, voice recorders
or walkie-talkies.
October 2008
Rev 2
1/21
273864601.002.png
Contents
AN2812
Contents
1
Speex codec overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
2
The vocoder application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.1
Vocoder application overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.2
Hardware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2.3
Speex codec implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.1
Speex codec settings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.2
Speex codec optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
2.3.3
Speex codec requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4
Vocoder firmware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
2.4.1
Playback application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
2.4.2
Record and play application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
2.4.3
Loopback application . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
3
Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
4
Revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
2/21
273864601.003.png
AN2812
List of tables
List of tables
Table 1.
Speex implementation requirements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Table 2.
Document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20
3/21
273864601.004.png
List of figures
AN2812
List of figures
Figure 1. STM32F101xx and STM32F103xx vocoder hardware description . . . . . . . . . . . . . . . . . . . . 6
Figure 2. OLIMEX STM32F103-STK audio input/output stages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
Figure 3. Playback application flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Figure 4. Record & Play block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Figure 5. Main record application flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Figure 6. Main play application flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
Figure 7. TIM3_IRQHandler flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
Figure 8. Real-time loopback principle. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16
Figure 9. Loopback flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
Figure 10. TIM2_IRQHandler flowchart . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
4/21
273864601.005.png
AN2812
Speex codec overview
1
Speex codec overview
The Speex codec is an open-source, patent- and royalty-free software dedicated to speech
compression and decompression.
Speex is based on CELP (code-excited linear prediction) and designed to compress voice at
bitrates ranging from 2 to 44 kbps.
The features of Speex include:
– Narrowband (8 kHz), wideband (16 kHz), and ultrawideband (32 kHz) compression in
the same bitstream
– Intensity stereo encoding
– Packet loss concealment
– Variable bitrate operation (VBR)
– Voice activity detection (VAD)
– Discontinuous transmission (DTX)
– Fixed-point port
– Acoustic echo canceller
– Noise suppression
Note that Speex has a number of features that are not present in other codecs, such as
intensity stereo encoding, integration of multiple sampling rates in the same bitstream
(embedded coding), and a VBR mode.
For more information about the Speex codec, please refer to the Speex website:
www.speex.org .
Note:
This application note was developed with the release 1.2rc1 of the Speex codec.
5/21
273864601.001.png
Zgłoś jeśli naruszono regulamin