![]() |
|
If you can't view the Datasheet, Please click here to try to view without PDF Reader . |
|
Datasheet File OCR Text: |
may 2014 docid024112 rev 1 1/26 AN4229 application note how to implement a vocoder soluti on using stm32 microcontrollers introduction this application note describes the vocal codecs (vocoder) available for stm32 32-bit arm ? cortex ? m icrocontrollers. the supported codecs are g.711, g.726, ima-adpcm and speex. it comes with examples of implementati on on stm32f4discovery (referred as discovery board hereafter), stm322xg-eval and stm324xg-eval (referred as eval boards hereafter). these examples are developed in such a way th at they can be easily ported to any other stm32 microcontroller and board. the vocoder firmware package is provided upon request, for more details please contact your local st sales representative. table 1. applicable products type applicable products microcontrollers stm32 32-bit arm cortex mcu www.st.com
contents AN4229 2/26 docid024112 rev 1 contents 1 vocoder overview and co mparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.1 g.711 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.2 g.726 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 1.3 ima-adpcm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.4 speex . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 1.5 vocoder comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 1.6 vocoder performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 2 package content and description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.1 firmware description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 2.2 audio api description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 2.3 player and recorder processes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3.1 audio player . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 2.3.2 audio recorder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 2.4 software . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 3 how to use the demonstration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.1 hardware configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2 firmware configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.3 main application steps . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3.3.1 player menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 3.3.2 recording format menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 3.3.3 recorder menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 3.4 simple examples . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 4 memory footprint . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 5 faq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 6 references . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 7 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 docid024112 rev 1 3/26 AN4229 list of tables 3 list of tables table 1. applicable products . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 table 2. codecs comparison . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7 table 3. g.711 performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 table 4. g.726 decoder performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 table 5. ima-adpcm performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 table 6. speex encoder performance . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 table 7. speex encoded frame size . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 table 8. project footprints . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 table 9. faq . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 table 10. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 list of figures AN4229 4/26 docid024112 rev 1 list of figures figure 1. g.726 versus g.711 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 figure 2. project tree . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10 figure 3. firmware layers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11 figure 4. demonstration architecture. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12 figure 5. high layer audio player api . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 figure 6. high layer audio recorder api. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 7. player process (triple-buffering mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 8. recorder process (double-bufferi ng mode) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 figure 9. initial state. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 figure 10. player and recorder selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 11. player description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 12. recording format selection menu . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 13. recorder description. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21 docid024112 rev 1 5/26 AN4229 vocoder overview and comparison 25 1 vocoder overview and comparison a vocoder is a speech encoding, decoding and filtering application used to reproduce the human voice. in this application note, four speech codecs are implemented: g.711, g.726, ima-adpcm and speex. in the following sections, a short overview of these codecs is presented. 1.1 g.711 the g.711 codec is an itu-t (telecommu nication section of the international telecommunication union) standard for the compression of voice frequency signals. its principal features are: ? sampling frequency: 8 khz ? 64 kbit/s bitrate (8 khz sampling frequency, 8-bit samples) ? compression ratio: 1:2 ? used with itu-t re commendations g.726 g.711 defines two main compression algorithms, the -law algorithm (used in north america and japan) and a-law algorithm (used in europe and the rest of the world). both are logarithmic, but a-law was specifically designed to reduce computer processing requirements. g.711 is primarily used in telephony, but it can also be used for fax communication over ip networks. 1.2 g.726 g.726 is an itu-t adpcm speech codec standard covering the transmission of voice at rates of 16, 24, 32, and 40 kbit/s; actually, it supersedes both g.721 (adpcm at 32 kbits/s) and g.723 (adpcm at 24 and 40 kbits/s). it also introduces a new 16 kbit/s rate ( figure 1 ). g.726 main features are: ? sampling frequency: 8 khz ? bitrates: 16 kbit/s, 24 kbit/s, 32 kbit/s and 40 kbit/s ? uses adaptive differential pulse code modulation (adpcm) in addition to dect (digital enhanced cordless telecommunications) telephony, where g.726 is widely used, it is also used in seve ral fields such as data and voice carrying (depending on the selected channel bitrate). vocoder overview and comparison AN4229 6/26 docid024112 rev 1 figure 1. g.726 versus g.711 1.3 ima-adpcm adpcm (adaptive differential pulse code modulati on) is a variant of dpcm that varies the size of the quantization step, to allow further reduction of the required bandwidth for a given signal-to-noise ratio. ima-adpcm is a legacy audio codec developed by interactive multimed ia association (ima) with the following characteristics: ? sampling frequencies: 8 (only frequency suppo rted here), 11.025, 22.05, or 44.1 khz. ? compression ratio: 1:4 the main advantage of the ima adpcm compress ion algorithm reside in its simplicity. the algorithm is not limited to voice signals and can operate at any input sampling rate thus enabling compression of high quality audio as well. 1.4 speex the speex codec is an open-source, patent-free 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 kbit/s. 0 6 9 * $ * 'x? ?? <]?l? 'x?? ?ele <]?l? . e l w v 'x e <]?l? er]? ?u?o ~? <]?l? ?r]? ro }? rro ?u?o ?u ?u eu ? ]?? w d ?u?o & |