Go to the documentation of this file.
18 #include "picovoice.h"
20 #define PV_INT16_MAX (32767)
21 #define PV_INT16_MIN (-32767 - 1)
23 #define pv_int32_to_int16(N) (((N)<(PV_INT16_MIN))?(PV_INT16_MIN):(((N)>(PV_INT16_MAX))?(PV_INT16_MAX):(N)))
28 #define PV_AUDIO_REC_AUDIO_FREQUENCY (16000U)
29 #define PV_AUDIO_REC_CHANNEL_NUMBER (2)
30 #define PV_AUDIO_REC_RECORD_BUFFER_SIZE (512)
31 #define PV_AUDIO_REC_VOLUME_LEVEL (100)
33 #define AUDIO_IN_PCM_BUFFER_SIZE (PV_AUDIO_REC_RECORD_BUFFER_SIZE)
34 #define AUDIO_IN_PDM_BUFFER_SIZE (AUDIO_IN_PCM_BUFFER_SIZE / 4)
99 static inline int16_t
pv_hpf(int16_t s_int16, int16_t s_old_int16) {
101 pv_audio_rec.filter_old_output = (0xFC * (
pv_audio_rec.filter_old_output + (int32_t) s_int16 - (int32_t) s_old_int16)) / 0x100;
static int32_t write_index
uint32_t record_buffer_size
pv_status_t pv_audio_rec_stop(void)
static int16_t ping_pong_buffer[2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
uint8_t BSP_AUDIO_IN_Stop(void)
Stops audio recording.
@ PV_STATUS_INVALID_STATE
void BSP_AUDIO_IN_TransferComplete_CallBack(void)
User callback when record buffer is filled.
void BSP_AUDIO_IN_DeInit(void)
Deinit the audio IN peripherals.
uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
Initializes wave recording.
#define PV_AUDIO_REC_CHANNEL_NUMBER
pv_status_t pv_audio_rec_start(void)
#define PV_AUDIO_REC_RECORD_BUFFER_SIZE
uint16_t * record_pcm_buffer
pv_status_t pv_audio_rec_init(void)
int32_t filter_old_output
static int32_t buffer_index
#define pv_int32_to_int16(N)
static int32_t last_read_index
uint8_t BSP_AUDIO_IN_Record(uint16_t *pbuf, uint32_t size)
Starts audio recording.
#define AUDIO_IN_PCM_BUFFER_SIZE
void pv_audio_rec_deinit(void)
uint8_t BSP_AUDIO_IN_AllocScratch(int32_t *pScratch, uint32_t size)
Allocate channel buffer scratch.
#define AUDIO_IN_PDM_BUFFER_SIZE
#define PV_AUDIO_REC_AUDIO_FREQUENCY
static int16_t pv_hpf(int16_t s_int16, int16_t s_old_int16)
static uint16_t record_pdm_buffer[AUDIO_IN_PDM_BUFFER_SIZE]
#define DEFAULT_AUDIO_IN_BIT_RESOLUTION
ALIGN_32BYTES(static int32_t record_pdm_buffer[AUDIO_IN_PDM_BUFFER_SIZE])
const int16_t * pv_audio_rec_get_new_buffer(void)
static int32_t read_index
void BSP_AUDIO_IN_HalfTransfer_CallBack(void)
Manages the DMA Half Transfer complete event.
void BSP_AUDIO_IN_Error_CallBack(void)
Audio IN Error callback function.
This file contains the common defines and functions prototypes for the stm32f769i_discovery_audio....