Audio and Speech Recording / Encoding / Compression Application Solutions
Recording of speech or audio signals requires compressing (encoding) it for efficient storage or transmission. Some embedded applications may require recording of speech while the system is deployed in the field. A new voice message could be recorded as part of a field update to change an existing message being played back by the system. In the case of communication applications recording (including compression) may be performed prior to streaming out data.
In both cases, the quality of audio depends on both the compression scheme (G.726A, Speex, etc.) used in firmware as well as the hardware peripherals used (PWM, DAC etc.) for reproducing the sound. Most communication applications that require encoding of streaming audio will also require decoding of received speech data. In all applications requiring recording of speech, the processor throughput (MIPS) required by the MCU or DSC is largely dependent on the encoding algorithm. These applications are discussed in detail in the Communications section. In this section, we present the solutions required for playback-only applications in two parts:
The choice of software algorithm used to playback audio and speech signals depends on the compression algorithm used to encode/record the raw speech data prior to storage. The graph below compares a variety of compression schemes in use today. Microchip provides software libraries to support algorithms that require no payment of royalties, such as IMA ADPCM for 8- and 16-bit MCUs, G.711, Speex and G.726A for PIC24 MCU and dsPIC® DSCs and ADPCM for PIC32 MCUs.
Note: The MIPS usage statistics shown for algorithms within gray ellipses in the graph above represent the requirements of Microchip's implementation of these algorithms on 16-bit PIC® MCUs and dsPIC DSCs.
A decision on the algorithm to use is often based on a tradeoff between quality and memory costs incurred in saving large amounts of audio data. Another critical benchmark affecting the choice of processor used in recording applications is the MIPS needed to execute the encoding algorithm. The table below shows approximate MIPS needed for various algorithms on Microchip’s 16-bit MCUs and DSCs. Since most applications that require encoding also require decoding, the MIPS throughput for both encoding and decoding is presented below:
|Memory needed to store 1|
second of encoded speech
|8 KB||2,3,4 or 5 KB||1 KB|
CPU MIPS usage for Compression Algorithm as a percentage of MAx throughput
The table below provides approximate throughput of various Microchip families:
|Device Family||Architecture||MIPS (MHz)|
|PIC18 MCU||8-bit PIC®MCU||16|
|PIC24F MCU||16-bit PIC®MCU||16-70|
|dsPIC DSC||16-bit dsPIC®DSC||40-70|
|PIC32MM MCU||32-bit PIC® MM Family MCU||25 MHz|
|PIC32 MCU||32-bit PIC®MCU||200|
A couple of variations are available for implementation in hardware based on trade-offs on quality of audio versus system cost, simplicity versus system-integration etc. Popular methods supported by Microchip’s MCUs and DSCs are shown below:
- Use on-chip A/D Converter
- Use off-chip Codecs or A/D Converters