Speech and audio compression/decompression technology based on MSP430

introduction

It is relatively simple to implement a voice recorder using a microcontroller (MCU). Many MCUs use an integrated analog-to-digital (A/D) converter. The loudspeaker supplies the captured sound to the amplifier and then to the analog input of the A/D converter. The recorded sound can be stored in a memory such as flash memory or RAM, and the MCU can be triggered to play the recorded sound by pressing the button. The principle is to supply the stored data to the digital-to-analog (D/A) converter first, and then Provided to the audio power amplifier.

This voice recorder is easily implemented with the MSP430. The MSP430 microcontroller utilizes integrated peripherals to implement an on-chip analog signal chain. In addition, the MSP430's CPU processing power is very powerful enough to perform compression of recorded sound.

Compression and decompression algorithm

For example, the easiest way to implement a voice recorder is to store the A/D converter conversion results (such as 12-bit samples) directly in flash memory. Audio data does not use the entire A/D converter range most of the time, that is, redundant data is also stored in flash memory. The compression algorithm removes these redundant information, thereby reducing the capacity of the stored data.

Adaptive Differential Pulse Code Modulation (ADPCM) is this type of compression algorithm. There are various types of ADPCM algorithms, but both use quantizer differential coding and an adaptive quantization step size scheme in the quantizer. Before we discuss the IMA ADPCM algorithm for related code further, let's first briefly introduce differential PCM coding.

Differential Pulse Code Modulation (DPCM)

DPCM encodes the analog audio input signal by using the difference between the current sample and the previous sample. Figure 1 shows the block diagram of the DPCM encoder and decoder. In this example, we use the signal to estimate Se(n) instead of the previous input to determine the signal difference d(n), thus ensuring that the encoder uses the same information as the decoder. If the encoder uses the previous input sample, it will cause a cumulative error in the quantization, making the reconstructed signal different from the original input signal. By using the signal estimation shown in Figure 1, we can avoid the difference between the reconstructed signal Sr(n) and the original input signal. The reconstruction signal Sr(n) is the input to the predictor, which determines the next signal estimate Se(n+1).

Signal estimation

Figure 2 shows a small recorded audio stream with a comparison of the difference between the analog audio input sample (PCM value) and the continuous sample (DPCM value).

A comparison of the difference between analog audio input samples (PCM values) and continuous samples (DPCM values).

The PCM values ​​range from 26 to 203 for a total of 177 steps. The encoded DPCM values ​​range from -44 to 46 for a total of 90 steps. Although the quantizer step size is only 1, this DPCM encoding has achieved compression of the input data. Simply select a larger quantizer step size to further narrow the range of coded DPCM values.

Portable Solar Energy System

Portable power supply humanized output port design: AC dual output port 220V output, to solve multi-channel power demand; DC 24V, 12V cigarette lighter, dual 5V USB output, more widely used. Can meet the needs of most electrical appliances, such as energy storage system for LED Light,energy storage system for outdoor, energy storage system for medical equipment,mobile phones, telephones, digital cameras, mobile hard drives, digital cameras, tablets, laptops, car starters, pumps, postal and telecommunications, environmental instruments Etc; can also be used in the following areas such as: finance, first aid, excavation, exploration, military, science, media, tourism, disaster relief, medical assistance, environmental protection and areas with widespread power shortages.

Rechargeable Battery Pack,Portable Lithium Battery,Portable Solar Energy System,Portable Solar Energy Storage System,Portable Lithium-Ion Battery,Portable Electric Backup

Shenzhen Enershare Technology Co.,Ltd , https://www.enersharepower.com

Posted on