Reference
Last revision 2025/12/25
The article explores Arduino API functionalities for initializing devices, retrieving microphone data, and creating WAV file headers, including techniques for Bluetooth and audio processing.
API Description
/**
* @fn begin
* @brief Initialize the device
* @param baudRate Communication rate
* @param bit the number of data bit
* @return Return init status
*/
uint8_t begin(uint16_t baudRate,uint8_t bit)
/**
* @brief Get the data returned from microphone
* @param buffer Get data buffer
* @param len Get data length
* @return Return the obtained data length
*/
uint32_t read(char *buffer,size_t len)
/**
* @brief Construct the header for the WAVE file
* @param header Construct the WAVE file
* @param totalDataLen The length of the data to be written
* @param longSampleRate Sampling frequency
* @param channels The number of sound channels
* @param byteRate Byte rate, calculation formula: sampling rate × the number of sound channels × data bit/8
* @param blockAlign Block-aligning way, calculation formula: the number of sound channels × data bit/8
*/
void createWavHeader(byte* header, int totalDataLen, int longSampleRate, uint8_t channels, int byteRate, uint8_t blockAlign)
/**
* @brief Initialize bluetooth & a2dp
* @param name Bluetooth Name
* @param callback a2dp sends data callback function
* @param volume Volume
*/
bool begin(const char* name, esp_a2d_source_data_cb_t callback,uint8_t volume);
Was this article helpful?
