Go to the documentation of this file.
18 #include "picovoice.h"
22 #define PV_AUDIO_REC_AUDIO_FREQUENCY (16000U)
23 #define PV_AUDIO_REC_CHANNEL_NUMBER (1)
24 #define PV_AUDIO_REC_RECORD_BUFFER_SIZE (512)
25 #define PV_AUDIO_REC_VOLUME_LEVEL (80)
27 #define AUDIO_IN_PCM_BUFFER_SIZE (MIC_CAPTURE_IT_MS * 16)
42 #define PV_AUDIO_DUMP_DURATION_SEC (3)
43 #define PV_AUDIO_REC_AUDIO_FREQUENCY (16000U)
44 #define PV_AUDIO_DUMP_BUFFER_SIZE ((uint32_t)(PV_AUDIO_DUMP_DURATION_SEC * PV_AUDIO_REC_AUDIO_FREQUENCY))
160 for (uint32_t i = 0; i < temp_buffer_size; i++) {
171 for (uint32_t i = 0; i < temp_buffer_size; i++) {
#define SAI_FS_STARTFRAME
uint32_t InputDataInversionMode
SAI_HandleTypeDef hsai_BlockA4
HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc)
#define SAI_FREE_PROTOCOL
#define NVIC_GetPriorityGrouping
#define SAI_FIFOTHRESHOLD_1QF
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
#define SAI_OUTPUTDRIVE_DISABLE
#define SAI_CLOCKSTROBING_FALLINGEDGE
uint32_t ActiveFrameLength
DMA handle Structure definition.
static int32_t buffer_index
#define __HAL_RCC_DMA1_CLK_ENABLE()
#define SAI_SLOTSIZE_DATASIZE
uint8_t DefaultInitValueUse
static void MX_BDMA_Init(void)
static void MX_DMA_Init(void)
#define DEFAULT_INIT_VALUE_ENABLE
#define AUDIO_IN_PCM_BUFFER_SIZE
#define DEFAULT_POLYNOMIAL_ENABLE
UART handle Structure definition.
__STATIC_INLINE uint32_t NVIC_EncodePriority(uint32_t PriorityGroup, uint32_t PreemptPriority, uint32_t SubPriority)
Encode Priority.
SAI_Block_TypeDef * Instance
#define SAI_MODEMASTER_RX
#define CRC_OUTPUTDATA_INVERSION_DISABLE
pv_status_t pv_audio_rec_stop(void)
pv_status_t pv_audio_rec_init(void)
#define PV_AUDIO_REC_RECORD_BUFFER_SIZE
void pv_pcm_process(int16_t *record_pcm_buffer)
const int16_t * pv_audio_rec_get_new_buffer(void)
static int32_t write_index
#define SAI_PDM_CLOCK2_ENABLE
static int32_t read_index
#define SAI_AUDIO_FREQUENCY_MCKDIV
static void MX_SAI4_Init(void)
static int32_t last_read_index
static int16_t ping_pong_buffer[2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
#define SAI_MASTERDIVIDER_DISABLE
CRC Handle Structure definition.
FunctionalState Activation
void MX_PDM2PCM_Init(void)
pv_status_t pv_audio_rec_start(void)
#define __HAL_CRC_DR_RESET(__HANDLE__)
Reset CRC Data Register.
HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai)
static void MX_CRC_Init(void)
uint16_t * record_pcm_buffer
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
int mic_capture_start(void)
void pv_error_handler(void)
uint8_t DefaultPolynomialUse
uint32_t OutputDataInversionMode
uint32_t record_buffer_size
DMA_HandleTypeDef hdma_sai4_a
#define SAI_FS_ACTIVE_HIGH
SAI_SlotInitTypeDef SlotInit
SAI_FrameInitTypeDef FrameInit
#define __HAL_RCC_BDMA_CLK_ENABLE()
SAI_PdmInitTypeDef PdmInit