基于 STM32 的语音存储与回放系统设计
Xxxx
1
(1. 武汉理工大学机电工程学院测控技术与仪器系 武汉 430070)
摘要:本文主要介绍了语音存储与回放的嵌入式系统设计原理及方法。通过使用拾音器将音频信号转化为电信号,对其进行
放大,然后对电信号进行滤波之后,使用 ADC 将其转换为数字信号进行存储。回放则是存储的逆过程,读取储存的信息,
然后进行滤波后,进行功率放大,驱动扬声器产生音频。还可以控制功放的倍数来控制音频音量的大小。为了在有限的存储
空间储存更多的音频信息,提高储存芯片的利用率,采用了非失真压缩算法对语音信号进行压缩,然后再储存,回放的时候
在将其进行解压。
关键词:语音存储与回放 STM32 单片机 数字化存储
Design of a Speech Storage and Playback System based on STM32
Xxxx
1
(1. Department of Measurement and Control Technology and Instruments, School of Mechanical and Electronic
Engineering, Wuhan University of Technology, Wuhan 430070)
Abstract:This article mainly introduce the embedded system design principles and methods of speech storage and playback. By
using a microphone to convert the audio signal into an electrical signal, amplifying it, and then filtering the electrical signal, the signal
is converted into a digital signal and stored using an ADC. Playback is the reverse process of storage, reading the stored information,
filtering it, and then power amplifying it to drive the speaker to produce audio. The amplifier can also be controlled to adjust the audio
volume by controlling the amplification factor. To store more audio information in limited storage space and improve the utilization of
storage chips, a non-distortion compression algorithm is used to compress the speech signal before storing it and decompress it during
playback.
Key words:Speech storage and playback STM32 microcontroller Digital storage
0
前言
随着现代化的发展,人们越来越追求小巧灵动
的电子产品。过去的磁带语音录放系统的体积较大,
不便于携带。本文中的数字化语音存储与回放系统
较磁带具有小巧低功耗的优点。其关键技术在于增
加语音存储的时间,提高存储空间的利用率
[1]
。
本系统能够对语音信号采用实时幅值采样法来
进行采样,完成了对语音信号的存储与回放。前置
放大、滤波与偏置电路将语音信号控制在 A/D 转换
器采样控制范围内以保证话音信号采样不失真。带
通滤波器有效的滤除了带外噪声,减小了混叠失真。
后置带通滤波器用于滤除 D/A 转换产生的高频噪声
以保证回放时音质清晰,无明显失真。
本系统设计主要分为一下几个模块:音频采集
模块、信号放大模块、带通滤波模块、A\D 转换模
块、CPU 处理模块、存储模块、D\A 转换模块、功
率放大模块、音频输出模块。音频采集模块用于将
声音进行采集并转换成微弱的电信号,然后通过信
号放大模块将微弱电信号放大到 A\D 转换模块的工
作范围,先经过带通滤波器,滤去杂音信号,然后
通过 A\D 转换模块将电信号模拟转换为数字量,传
入 CPU 进行处理与存储。音频的输出为音频采集的
逆过程,CPU 先读取出存储的语音信息,进行处理,
然后通过 D\A 转换为连续的模拟电信号,通过带通
滤波器滤去杂频信号,但是此时的电信号不足以驱
动扬声器,需要对其进行功率放大,然后驱动扬声
器输出音频信号。
1
编码方法分析
语音编码是指将语音信号转换为数字信号的过
程,以便于存储、传输和处理。
由 于 一 般 语 音 频 率 为 300~3400 Hz , 根 据
“Nyquist 采样定理”
[2]
, 采样频率必须大于模拟信