Go to the documentation of this file.
18 #include "picovoice.h"
20 #define PV_AUDIO_REC_AUDIO_FREQUENCY (16000U)
21 #define PV_AUDIO_REC_CHANNEL_NUMBER (1)
22 #define PV_AUDIO_REC_RECORD_BUFFER_SIZE (512)
23 #define PV_AUDIO_REC_VOLUME_LEVEL (100)
25 #define AUDIO_IN_PCM_BUFFER_SIZE ((uint32_t)(PV_AUDIO_REC_AUDIO_FREQUENCY / 1000 * PV_AUDIO_REC_CHANNEL_NUMBER))
26 #define AUDIO_IN_PDM_BUFFER_SIZE ((uint32_t)(128 * PV_AUDIO_REC_AUDIO_FREQUENCY / 16000 * PV_AUDIO_REC_CHANNEL_NUMBER))
static uint16_t record_pcm_buffer[2 *AUDIO_IN_PCM_BUFFER_SIZE]
pv_status_t pv_audio_rec_start(void)
uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume)
Controls the audio in volume level.
uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t *PDMBuf, uint16_t *PCMBuf)
Converts audio format from PDM to PCM.
void pv_audio_rec_deinit(void)
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.
static int32_t last_read_index
uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
Initializes wave recording.
static int32_t read_index
pv_status_t pv_audio_rec_init(void)
#define AUDIO_IN_PCM_BUFFER_SIZE
This file contains the common defines and functions prototypes for stm32f4_discovery_audio....
#define PV_AUDIO_REC_RECORD_BUFFER_SIZE
#define PV_AUDIO_REC_CHANNEL_NUMBER
uint32_t record_buffer_size
uint8_t BSP_AUDIO_IN_Record(uint16_t *pbuf, uint32_t size)
Starts audio recording.
static int32_t buffer_index
#define AUDIO_IN_PDM_BUFFER_SIZE
static int16_t ping_pong_buffer[2][PV_AUDIO_REC_RECORD_BUFFER_SIZE]
static uint16_t record_pdm_buffer[AUDIO_IN_PDM_BUFFER_SIZE]
#define DEFAULT_AUDIO_IN_BIT_RESOLUTION
void BSP_AUDIO_IN_HalfTransfer_CallBack(void)
Manages the DMA Half Transfer complete event.
#define PV_AUDIO_REC_AUDIO_FREQUENCY
const int16_t * pv_audio_rec_get_new_buffer(void)
#define PV_AUDIO_REC_VOLUME_LEVEL
static int32_t write_index