Dear sir or madam,
I have an ESP32-LYRATD-DSPG development board, and I'm developing an application that I need to capture the sound in DSPG microphone (ie. a acoustic guitar) in streaming and transmit it to the audio output while there are no commands for the voice assistant. I'm using the ESP-VA-SDK environment.
Is there any way to capture the sound of the microphone through the libaia library? I haven't found the function that does such feature. I adapted the libva_dsp library, which is libaia dependent, using the drive skeleton for the lyrat drive, and used media_hal_playback to play the sound for the output, but the quality is very bad and with a very long delay. I needed to use 8K as the sample rate on the media_hal_playback. It was the better quality I got.
I put the function va_app_speech_start (); in a loop to repeatedly capture the sound, just for testing, since the va_dsp thread stops capturing as soon as a silence is detected.
Thanks for your attention. I’m looking forward to your reply.
PS: I'm sending a patch attached that can be applied in the 2.17.1 git version of esp-va-sdk to have the environment I'm using:
$ patch -p1 -d esp-va-sdk/ < ./patch_esp-va-sdk_mic-v104.patch
**** Implementation of the Main file ******
#include <freertos/FreeRTOS.h>
#include <freertos/event_groups.h>
#include <esp_log.h>
#include <nvs_flash.h>
#include "va_board.h"
#include "va_dsp.h"
#include <custom_player.h>
#include <media_hal_playback.h>
// player for record callback
static const char *TAG = "[app_main]";
#define PLAYER_CODEC() { \
.sample_rate = 8000, \
.channels = 2, \
.bits_per_sample = 16, \
};
static media_hal_audio_info_t player_codec = PLAYER_CODEC();
// callback for data record
int speech_recognizer_record(void *data, int len)
{
//ESP_LOGE(TAG, "Rodrigo: record callback. %d",len);
media_hal_playback(&player_codec, data, len);
return 0;
}
// callback for data recognize
int speech_recognizer_recognize(int ww_length, enum initiator init_type)
{
//ESP_LOGE(TAG, "Rodrigo: callback reg. %d %d", ww_length, init_type);
return 0;
}
// main function
void app_main()
{
ESP_LOGI(TAG, "==== Microphone Streaming SDK version: %s ====", va_get_sdk_version());
esp_err_t ret = nvs_flash_init();
if (ret == ESP_ERR_NVS_NO_FREE_PAGES) {
ESP_ERROR_CHECK(nvs_flash_erase());
ret = nvs_flash_init();
}
ESP_ERROR_CHECK( ret );
va_board_init(); // Initialize media_hal, media_hal_playback, board buttons and led patters
// NOTE: libva_dsp is libaia dependent. It's necessary implement a new va_dsp code.
va_dsp_init(speech_recognizer_recognize, speech_recognizer_record); // This is a blocking call
va_app_speech_start();
while(1)
{
va_app_speech_start();
vTaskDelay(100);
}
return;
}
Help for DSPG microphone streaming
Help for DSPG microphone streaming
- Attachments
-
- patch_esp-va-sdk_mic-v104.txt
- (62.85 KiB) Downloaded 246 times
Who is online
Users browsing this forum: No registered users and 139 guests