STM32-MEMS麦克风采集、高级音频处理和音频输出

 FP-AUD-SMARTMIC1简介

        FP-AUD-SMARTMIC1是一个STM32Cube功能包。该软件包实现了一个完整的应用程序,目标是MEMS麦克风阵列的高级处理,包括数字MEMS麦克风采集、波束成形、源定位和回声消除。处理后的音频被发送到USB主机和连接到相关扩展板的扬声器。该功能包基于STM32Cube软件技术,可轻松在不同的STM32微控制器之间进行移植。

        此示例实现支持两种系统:STM32 NUCLEO-F446RE开发板,配备X-NUCLEO-CA01M1或X-NUCLEO-CA02M2扩展板和STEVAL-MIC001V1、STEVAL-MIC002V1、STEVAL-MIC003V1或STEVAL-MIC 005V1数字麦克风评估板或BlueCoin

        该软件也可以在GitHub上获得,用户可以通过“问题”和“拉取请求”选项卡发出错误信号并提出新想法。

所有功能

STM32Cube的软件扩展:

AcousticBF实时波束形成

AcousticEC实时声学回声消除

AcousticSL实时声源定位

完整的应用程序,包括单个示例应用程序中的所有声学功能软件图形用户界面,可从主机PC轻松控制参数和算法当连接到X-NUCLEO-CA01M1和X-NUCLEO-CA02M2扩展板时,NUCLEO-F446RE开发板上可用的示例实现

官网网站:FP-AUD-SMARTMIC1 - 专为MEMS麦克风采集、高级音频处理和音频输出打造的STM32Cube功能包 - 意法半导体STMicroelectronicsicon-default.png?t=N7T8https://www.st.com/zh/embedded-software/fp-aud-smartmic1.htmlGithub:

GitHub - STMicroelectronics/fp-aud-smartmic1: FP-AUD-SMARTMIC1 provides a firmware running on STM32 which acquires audio signals of four digital MEMS microphones, elaborates them by means of embedded DSP libraries and streams the processed audio to both an USB host and a loudspeaker connected to the relevant expansion board.icon-default.png?t=N7T8https://github.com/STMicroelectronics/fp-aud-smartmic1


AcousticSL实时声源定位

本文针对该功能包中的声源定位算法进行探索研究,相关算法文件的可以从Github中下载

文件夹路径fp-aud-smartmic1-main\Middlewares\ST\STM32_AcousticSL_Library

重点文件内容

acoustic_sl.h
/*
此文件包含声学声源定位库定义。
*/
#ifndef __ACOUSTIC_SL_H
#define __ACOUSTIC_SL_H

#include "stdint.h"

/*算法类型定义*/
#define ACOUSTIC_SL_ALGORITHM_XCORR                	((uint32_t)0x00000001)
#define ACOUSTIC_SL_ALGORITHM_GCCP                 	((uint32_t)0x00000002)
#define ACOUSTIC_SL_ALGORITHM_BMPH                 	((uint32_t)0x00000004)

/*错误类型*/
#define ACOUSTIC_SL_ALGORITHM_ERROR                	((uint32_t)0x00000001)
#define ACOUSTIC_SL_PTR_CHANNELS_ERROR             	((uint32_t)0x00000002)
#define ACOUSTIC_SL_CHANNEL_NUMBER_ERROR           	((uint32_t)0x00000004)
#define ACOUSTIC_SL_SAMPLING_FREQ_ERROR            	((uint32_t)0x00000008)
#define ACOUSTIC_SL_RESOLUTION_ERROR               	((uint32_t)0x00000010)
#define ACOUSTIC_SL_THRESHOLD_ERROR                	((uint32_t)0x00000020)
#define ACOUSTIC_SL_DISTANCE_ERROR                 	((uint32_t)0x00000040)
#define ACOUSTIC_SL_NUM_OF_SAMPLES_ERROR           	((uint32_t)0x00000080)
#define ACOUSTIC_SL_PROCESSING_ERROR               	((uint32_t)0x00000100)

#ifndef ACOUSTIC_LOCK_ERROR
#define ACOUSTIC_LOCK_ERROR                      	((uint32_t)0x10000000)
#endif 

/**/
#define ACOUSTIC_SL_NO_AUDIO_DETECTED              -100  

/*输出参数结构体*/
typedef struct
{
  /*算法类型选择,即上述定义的XCORR,GCCP和BMPH*/
  uint32_t algorithm;        
                   
  /*设置采样频率*/
  uint32_t sampling_frequency;                 
  
  /*设置通道数,2通道进行180°定位,4通道进行360°定位*/
  uint32_t channel_number;                      

  /*麦克风通道选择*/
  uint8_t ptr_M1_channels;                      
  uint8_t ptr_M2_channels;                      
  uint8_t ptr_M3_channels;                      
  uint8_t ptr_M4_channels;                      
  
  /*麦克风1,2之间的距离(mm),默认150*/
  uint16_t M12_distance; 
  /*麦克风3,4之间的距离(mm),默认150*/                   
  uint16_t M34_distance;
  
  /*内部存储空间大小设置,采用AcousticSL_getMemorySize()函数*/
  uint32_t internal_memory_size;   
            
  /*指向用户分配的内存*/
  uint32_t * pInternalMemory;     
              
  /*指向单次处理的样本数*/
  int16_t samples_to_process; 
  
} AcousticSL_Handler_t;

typedef struct
{
  /*指定语音响度阈值,低于阈值算法不起作用,阈值范围从0到1000,默认值为24*/
  uint16_t threshold;    
   
  /*算法的角度分辨率,默认值为4.如果使用XCORR,则忽略*/                  
  uint32_t resolution;                         

} AcousticSL_Config_t;


/*内存分配函数*/
uint32_t AcousticSL_getMemorySize(AcousticSL_Handler_t * pHandler);

/*初始化函数*/
uint32_t AcousticSL_Init(AcousticSL_Handler_t * pHandler);

/*数据输入函数*/
uint32_t AcousticSL_Data_Input(void *pM1, void *pM2, void *pM3, void *pM4, AcousticSL_Handler_t * pHandler);

/*音频处理函数*/
uint32_t AcousticSL_Process(int32_t * Estimated_Angle, AcousticSL_Handler_t * pHandler);

/*设置阈值与分辨率的值*/
uint32_t AcousticSL_setConfig(AcousticSL_Handler_t * pHandler, AcousticSL_Config_t * pConfig);

/*获取参数*/
uint32_t AcousticSL_getConfig(AcousticSL_Handler_t * pHandler, AcousticSL_Config_t * pConfig);

/*获取版本信息*/
uint32_t AcousticSL_GetLibVersion(char *version);

#endif

该功能可以选择三种不同的声源定位算法,分别是XCORR(时域互相关),GCCP(频域变换广义互相关),BMPH(The block-matching pursuit with hangover

XC

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

ChengWYang

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值