espressif / esp-va-sdk

Espressif's Voice Assistant SDK: Alexa, Google Voice Assistant, Google DialogFlow
Other
290 stars 82 forks source link

用例lyrat_alexa_sr怎么保存音频数据到SD卡 #11

Open xiaoseyihe opened 5 years ago

xiaoseyihe commented 5 years ago

用例lyrat_alexa_sr怎么保存音频数据到SD卡?通过fopen保存数据到SD卡

xiaoseyihe commented 5 years ago

@avsheth 你好,我怎么才能在测试用例lyrat_alexa_sr中 采集到MIC 数据并保存到SD卡中呢?

avsheth commented 5 years ago

@xiaoseyihe In app_dsp.c, raw mic data is given to speech_recognizer_record API. You can write this buffer (passed to speech_recognizer_record API as an argument) to SD card.

xiaoseyihe commented 5 years ago

@avsheth 感谢你的回答,我如下保存数据,但是代码运行出错,请问系统支持fopen、fwrite等系统函数吗? while(1) { rb_read(dd.temp_rb, (uint8_t )dd.data_buf, SAMPLE_SZ 2, portMAX_DELAY); sent_len = audio_resample((short )dd.data_buf, (short )dd.data_buf, SAMP_RATE, DETECT_SAMP_RATE, SAMPLE_SZ, SAMPLE_SZ, 2, &dd.resample); sent_len = audio_resample_down_channel((short )dd.data_buf, (short )dd.data_buf, DETECT_SAMP_RATE, DETECT_SAMP_RATE, sent_len, SAMPLE_SZ, 0, &dd.resample); sent_len = sent_len * 2; //convert 16bit lengtth to number of bytes

    if(dd.detect_wakeword) {
        xQueueSend(dd.recog_queue, dd.data_buf, 0);
    } else if(dd.speech_recog_en) {
        speech_recognizer_record(dd.data_buf, sent_len);
        printf("recorded speech %d\n", sent_len);

        file = fopen("/sdcard/rec.pcm", "ab+");
        fwrite((short *)dd.data_buf,2,sent_len/2,file);
        fclose(file);

代码运行会报如下错误: speech_recognizer: length 0 I (423412) LYRAT_CB: Current mode is: 4 I (423412) [focus_manager]: Acquire channel: Dialog I (423412) [speech_recognizer]: On Focus: FOREGROUND I (423422) [sys_playback]: Acquire I (423422) [focus_manager]: Now active channel: Dialog I (423432) dsp: Flushed store data: 3840

recorded speech 640 Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled. Core 1 register dump: PC : 0x400d8e2c PS : 0x00060030 A0 : 0x800d8ec4 A1 : 0x3ffe9730
A2 : 0x3ffe98a4 A3 : 0x00000280 A4 : 0x00000002 A5 : 0x00000140
A6 : 0x00000000 A7 : 0x00000001 A8 : 0x3ffb4edc A9 : 0x3ffe9730
A10 : 0x3ffe9834 A11 : 0x3f409630 A12 : 0x0000020a A13 : 0x000001b6
A14 : 0x00000801 A15 : 0x0000002b SAR : 0x00000004 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000064 LBEG : 0x40099115 LEND : 0x40099125 LCOUNT : 0xfffffffb

Backtrace: 0x400d8e2c:0x3ffe9730 0x400d8ec1:0x3ffe9770 0x400d78cd:0x3ffe9790

Rebooting... ets Jun 8 2016 00:22:57

rst:0xc (SW_CPU_RESET),boot:0x3f (SPI_FAST_FLASH_BOOT) configsip: 0, SPIWP:0xee clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00 mode:DIO, clock div:1 load:0x3fff0018,len:4 load:0x3fff001c,len:6200 load:0x40078000,len:9940 load:0x40080000,len:6756 entry 0x40080350 I (29) boot: ESP-IDF v3.1-91-gf11ac03-dirty 2nd stage bootloader I (29) boot: compile time 11:41:17 I (33) boot: Enabling RNG early entropy source... I (35) qio_mode: Enabling QIO for flash chip GD I (40) boot: SPI Speed : 80MHz I (44) boot: SPI Mode : QIO I (48) boot: SPI Flash Size : 4MB I (52) boot: Partition Table: I (56) boot: ## Label Usage Type ST Offset Length I (63) boot: 0 nvs WiFi data 01 02 00009000 00006000 I (71) boot: 1 phy_init RF data 01 01 0000f000 00001000 I (78) boot: 2 avs WiFi data 01 02 00010000 00006000 I (86) boot: 3 factory factory app 00 00 00020000 00300000 I (93) boot: End of partition table I (97) esp_image: segment 0: paddr=0x00020020 vaddr=0x3f400020 size=0x15d7f0 (1431536) map I (485) esp_image: segment 1: paddr=0x0017d818 vaddr=0x3ffb0000 size=0x027f8 ( 10232) load I (488) esp_image: segment 2: paddr=0x00180018 vaddr=0x400d0018 size=0x100d20 (1051936) map I (769) esp_image: segment 3: paddr=0x00280d40 vaddr=0x3ffb27f8 size=0x02898 ( 10392) load I (773) esp_image: segment 4: paddr=0x002835e0 vaddr=0x3ffb5090 size=0x00000 ( 0) load I (776) esp_image: segment 5: paddr=0x002835e8 vaddr=0x40080000 size=0x00400 ( 1024) load I (785) esp_image: segment 6: paddr=0x002839f0 vaddr=0x40080400 size=0x19dd8 (105944) load I (829) esp_image: segment 7: paddr=0x0029d7d0 vaddr=0x400c0000 size=0x00000 ( 0) load I (829) esp_image: segment 8: paddr=0x0029d7d8 vaddr=0x50000000 size=0x00000 ( 0) load I (851) boot: Loaded app from partition at offset 0x20000 I (851) boot: Disabling RNG early entropy source... I (852) spiram: SPI RAM mode: flash 80m sram 80m I (857) spiram: PSRAM initialized, cache is in low/high (2-core) mode. I (864) cpu_start: Pro cpu up. I (868) cpu_start: Starting app cpu, entry point is 0x400814bc I (860) cpu_start: App cpu up. I (1368) spiram: SPI SRAM memory test OK I (1368) heap_init: Initializing. RAM available for dynamic allocation: I (1368) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM I (1375) heap_init: At 3FFC06F8 len 0001F908 (126 KiB): DRAM I (1381) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM I (1387) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM I (1394) heap_init: At 4009A1D8 len 00005E28 (23 KiB): IRAM I (1400) cpu_start: Pro cpu start user code I (1405) spiram: Adding pool of 4096K of external SPI memory to heap allocator I (1413) spiram: Reserving pool of 32K of internal memory for DMA/internal allocations I (92) cpu_start: Starting scheduler on PRO CPU. I (0) cpu_start: Starting scheduler on APP CPU. I (92) alexa: ==== Alexa SDK version: v1.0b1-165973 ====

avsheth commented 5 years ago

@xiaoseyihe can you post the entire code? Just want to check and verify mount configuration

xiaoseyihe commented 5 years ago

@avsheth 以下是app_dsp.c的代码。使用fopen、fwrite函数需要配置?怎么配置呢? /**** app_dsp.c ***/ /*

include

include

include

include <sys/time.h>

include <freertos/FreeRTOS.h>

include <freertos/task.h>

include <freertos/queue.h>

include

include

include

include "app_dsp.h"

include

include

include

include

include

include

include

include "resampling.h"

//Speech recognition headers

include

define WWE_TASK_STACK (8 * 1024)

define DETECT_SAMP_RATE 16000UL

define SAMP_RATE 48000UL

define SAMP_BITS 16

define SAMPLE_FRAME 320

define SAMPLE_MS 20

define PCM_SIZE (4 * 1024)

//Sample size for 20millisec data on 48KHz/16bit sampling. Division factor is (sectomillisec * bitsinbytes)

define SAMPLE_SZ ((SAMP_RATE I2S_BITS_PER_SAMPLE_16BIT SAMPLE_MS) / (1000 * 8))

static const char *TAG = "dsp";

ifdef CONFIG_AWS_IOT_SDK

extern xQueueHandle wake_word_sem;

endif

static struct dsp_data { int item_chunk_size; bool detect_wakeword; bool speech_recog_en; QueueHandle_t recog_queue; ringbuf_t temp_rb; audio_resample_config_t resample; i2s_stream_t read_i2s_stream; TaskHandle_t nn_task_handle; int pcm_stored_data; bool write_to_store; int16_t data_buf[SAMPLE_SZ]; char pcm_store[PCM_SIZE]; } dd;

static media_hal_config_t media_hal_conf = { .op_mode = MEDIA_HAL_MODE_SLAVE, .adc_input = MEDIA_HAL_ADC_INPUT_LINE1, .dac_output = MEDIA_HAL_DAC_OUTPUT_ALL, .codec_mode = MEDIA_HAL_CODEC_MODE_BOTH, .bit_length = MEDIA_HAL_BIT_LENGTH_16BITS, .format = MEDIA_HAL_I2S_NORMAL, .port_num = 0, };

static esp_err_t reader_stream_event_handler(void arg, int event, void data) { ESP_LOGI(TAG, "Reader stream event %d", event); return ESP_OK; }

static ssize_t dsp_write_cb(void h, void data, int len, uint32_t wait) { ssize_t sent_len; if(len == 0) { return 0; } sent_len = rb_write(dd.temp_rb, data, len, wait); return sent_len; }

int alexa_app_speech_stop() { ESP_LOGI(TAG, "Sending stop command"); dd.speech_recog_en = false; vTaskDelay(20/portTICK_RATE_MS); dd.detect_wakeword = true; ESP_LOGI(TAG, "Stopped I2S audio stream"); return ESP_OK; }

int alexa_app_speech_start() { ESP_LOGI(TAG, "Sending start command"); dd.detect_wakeword = false; ESP_LOGI(TAG, "Starting I2S audio stream"); dd.speech_recog_en = true; return ESP_OK; }

void app_dsp_reset() { return; }

void app_dsp_send_recognize() { ESP_LOGI(TAG, "Sending start command"); dd.detect_wakeword = false; ESP_LOGI(TAG, "Starting I2S audio stream"); dd.pcm_stored_data = 0; dd.write_to_store = true;

ifdef CONFIG_AWS_IOT_SDK

xSemaphoreGive(wake_word_sem);

endif

ui_led_set(true);

}

void read_rb_task(void arg) { size_t sent_len; FILE file = NULL;

while(1) {
    rb_read(dd.temp_rb, (uint8_t *)dd.data_buf, SAMPLE_SZ * 2, portMAX_DELAY);
    sent_len = audio_resample((short *)dd.data_buf, (short *)dd.data_buf, SAMP_RATE, DETECT_SAMP_RATE, SAMPLE_SZ, SAMPLE_SZ, 2, &dd.resample);
    sent_len = audio_resample_down_channel((short *)dd.data_buf, (short *)dd.data_buf, DETECT_SAMP_RATE, DETECT_SAMP_RATE, sent_len, SAMPLE_SZ, 0, &dd.resample);
    sent_len = sent_len * 2;  //convert 16bit lengtth to number of bytes

    if(dd.detect_wakeword) {
        xQueueSend(dd.recog_queue, dd.data_buf, 0);
    } else if(dd.speech_recog_en) {
        speech_recognizer_record(dd.data_buf, sent_len);
        printf("recorded speech %d\n", sent_len);

        file = fopen("/sdcard/rec.pcm", "ab+");
        fwrite((short *)dd.data_buf,2,sent_len/2,file);
        fclose(file);

    } else if (dd.write_to_store) {
        if ( (dd.pcm_stored_data + sent_len) < sizeof(dd.pcm_store)) {
            //printf("Writing to store at pcm_stored_data %d %d sizeof %d\n", dd.pcm_stored_data, sent_len, sizeof(dd.pcm_store));
            memcpy(dd.pcm_store + dd.pcm_stored_data, dd.data_buf, sent_len);
            dd.pcm_stored_data += sent_len;
        } else {
            /* store buffer is full, raise the 'Recognize' event, and flush the data */
            ESP_LOGI(TAG, "Sending recognize command"); 

            speech_recognizer_recognize(0, TAP);
            speech_recognizer_record(dd.pcm_store, dd.pcm_stored_data);
            ESP_LOGI(TAG, "Flushed store data: %d\n", dd.pcm_stored_data);

            //Send data which is not flushed in buffer
            speech_recognizer_record(dd.data_buf, sent_len);
            dd.write_to_store = false;
            dd.speech_recog_en = true;
        }
    }
}

}

void nn_task(void *arg) { int frequency = esp_wwe_get_sample_rate(); int audio_chunksize = esp_wwe_get_sample_chunksize();

int16_t *buffer = malloc(audio_chunksize*sizeof(int16_t));
assert(buffer);
int chunks=0;
int priv_ms = 0;
while(1) {
    if (dd.detect_wakeword) {
        xQueueReceive(dd.recog_queue, buffer, portMAX_DELAY);
        int r = esp_wwe_detect(buffer);
        if (r && dd.detect_wakeword) {
            int new_ms = (chunks*audio_chunksize*1000)/frequency;
            printf("%.2f: Neural network detection triggered output %d.\n", (float)new_ms/1000.0, r);
            int x = (new_ms - priv_ms);
            priv_ms = new_ms;
            if(x != 20) {
                app_dsp_send_recognize();
            }
        }
        chunks++;
    } else {
        memset(buffer, 0, (audio_chunksize * 2));
        vTaskDelay(100/portTICK_RATE_MS);
    }
}

}

void app_dsp_init(void) { dd.temp_rb = rb_init("nn-recog", 4 * 1024); ui_led_init(); ui_button_init();

i2s_stream_config_t i2s_cfg;
memset(&i2s_cfg, 0, sizeof(i2s_cfg));
i2s_cfg.i2s_num = 0;
audio_board_i2s_init_default(&i2s_cfg.i2s_config);
i2s_cfg.media_hal_cfg = media_hal_init(&media_hal_conf);

dd.read_i2s_stream = i2s_reader_stream_create(&i2s_cfg);
if (dd.read_i2s_stream) {
    ESP_LOGI(TAG, "Created I2S audio stream");
} else {
    ESP_LOGE(TAG, "Failed creating I2S audio stream");
}
i2s_stream_set_stack_size(dd.read_i2s_stream, 5000);

audio_io_fn_arg_t stream_reader_fn = {
    .func = dsp_write_cb,
    .arg = NULL,
};
audio_event_fn_arg_t stream_event_fn = {
    .func = reader_stream_event_handler,
};
if (audio_stream_init(&dd.read_i2s_stream->base, "i2s_reader", &stream_reader_fn, &stream_event_fn) != 0) {
    ESP_LOGE(TAG, "Failed creating audio stream");
    i2s_stream_destroy(dd.read_i2s_stream);
    dd.read_i2s_stream = NULL;
}

if (esp_wwe_init() != ESP_OK) {
    ESP_LOGE(TAG, "Failed to init ESP-WWE");
    return;
}

//Initialize sound source
dd.item_chunk_size = esp_wwe_get_sample_chunksize() * sizeof(int16_t);
dd.recog_queue = xQueueCreate(1, dd.item_chunk_size);
xTaskCreate(&nn_task, "nn", WWE_TASK_STACK, NULL, (CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT - 1), &dd.nn_task_handle);
xTaskCreate(&read_rb_task, "rb read task", WWE_TASK_STACK, NULL, (CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT - 1), NULL);

audio_stream_start(&dd.read_i2s_stream->base);
vTaskDelay(10/portTICK_RATE_MS);
audio_stream_stop(&dd.read_i2s_stream->base);
i2s_set_clk(I2S_NUM_0, SAMP_RATE, SAMP_BITS, I2S_CHANNEL_STEREO);
vTaskDelay(10/portTICK_RATE_MS);
audio_stream_start(&dd.read_i2s_stream->base);
dd.detect_wakeword = true;

}

avsheth commented 5 years ago

@xiaoseyihe I don't see any calls to mount the SD card filesystem. Please refer to SD card example to get started with SD card

xiaoseyihe commented 5 years ago

@avsheth i refer to SD card example to get started with SD card,but, the following error occurred。 I (3162) conn_mgr: got ip:192.168.1.6 I (3162) conn_mgr: Received event: 128 I (3172) alexa: got IPv4:192.168.1.6 I (3172) I2S: DMA Malloc info, datalen=blocksize=600, dma_buf_count=3 I (3182) I2S: DMA Malloc info, datalen=blocksize=600, dma_buf_count=3 I (3182) I2S: PLL_D2: Req RATE: 16000, real rate: 16025.000, BITS: 16, CLKM: 39, BCK: 8, MCLK: 4096000.000, SCLK: 512800.000000, diva: 64, divb: 4 I (3202) gpio: GPIO[22]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0 I (3212) gpio: GPIO[19]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:0 I (3222) UI_LED: LED initialized I (3222) gpio: GPIO[36]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:1 I (3232) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 1| Intr:3 I (3242) gpio: GPIO[21]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 I (3272) dsp: Created I2S audio stream I (3272) audio_stream: Starting i2s_reader stream I (3322) dsp: Initializing SD card I (3322) dsp: Using SDMMC peripheral I (3322) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0 E (3352) sdmmc_cmd: sdmmc_card_init: send_scr (2) returned 0xffffffff E (3352) dsp: Failed to mount filesystem. If you want the card to be formatted, set format_if_mount_failed = true. I (3362) audio_stream: Starting playback_writer stream Starting audio stream playback_writer I (3372) audio_stream: Stream playback_writer Event Started I (3372) avs-nvs-util: No value set for: speaker_vol I (3382) [speaker]: Using default volume I (3392) LYRAT_CB: Volume changed to 40

Code show as below:

//#define USE_SPI_MODE

ifdef USE_SPI_MODE

// Pin mapping when using SPI mode. // With this mapping, SD card can be used both in SPI and 1-line SD mode. // Note that a pull-up on CS line is required in SD mode.

define PIN_NUM_MISO 2

define PIN_NUM_MOSI 15

define PIN_NUM_CLK 14

define PIN_NUM_CS 13

endif //USE_SPI_MODE

void app_dsp_init(void) { dd.temp_rb = rb_init("nn-recog", 4 * 1024); ui_led_init(); ui_button_init();

i2s_stream_config_t i2s_cfg;
memset(&i2s_cfg, 0, sizeof(i2s_cfg));
i2s_cfg.i2s_num = 0;
audio_board_i2s_init_default(&i2s_cfg.i2s_config);
i2s_cfg.media_hal_cfg = media_hal_init(&media_hal_conf);

dd.read_i2s_stream = i2s_reader_stream_create(&i2s_cfg);
if (dd.read_i2s_stream) {
    ESP_LOGI(TAG, "Created I2S audio stream");
} else {
    ESP_LOGE(TAG, "Failed creating I2S audio stream");
}
i2s_stream_set_stack_size(dd.read_i2s_stream, 5000);

audio_io_fn_arg_t stream_reader_fn = {
    .func = dsp_write_cb,
    .arg = NULL,
};
audio_event_fn_arg_t stream_event_fn = {
    .func = reader_stream_event_handler,
};
if (audio_stream_init(&dd.read_i2s_stream->base, "i2s_reader", &stream_reader_fn, &stream_event_fn) != 0) {
    ESP_LOGE(TAG, "Failed creating audio stream");
    i2s_stream_destroy(dd.read_i2s_stream);
    dd.read_i2s_stream = NULL;
}

if (esp_wwe_init() != ESP_OK) {
    ESP_LOGE(TAG, "Failed to init ESP-WWE");
    return;
}

/************挂载SD卡到系统文件 20181024 start****************/
ESP_LOGI(TAG, "Initializing SD card");

#ifndef USE_SPI_MODE
ESP_LOGI(TAG, "Using SDMMC peripheral");
sdmmc_host_t host = SDMMC_HOST_DEFAULT();

// This initializes the slot without card detect (CD) and write protect (WP) signals.
// Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.
sdmmc_slot_config_t slot_config = SDMMC_SLOT_CONFIG_DEFAULT();

// To use 1-line SD mode, uncomment the following line:
// slot_config.width = 1;

// GPIOs 15, 2, 4, 12, 13 should have external 10k pull-ups.
// Internal pull-ups are not sufficient. However, enabling internal pull-ups
// does make a difference some boards, so we do that here.
gpio_set_pull_mode(15, GPIO_PULLUP_ONLY);   // CMD, needed in 4- and 1- line modes
gpio_set_pull_mode(2, GPIO_PULLUP_ONLY);    // D0, needed in 4- and 1-line modes
gpio_set_pull_mode(4, GPIO_PULLUP_ONLY);    // D1, needed in 4-line mode only
gpio_set_pull_mode(12, GPIO_PULLUP_ONLY);   // D2, needed in 4-line mode only
gpio_set_pull_mode(13, GPIO_PULLUP_ONLY);   // D3, needed in 4- and 1-line modes

else

ESP_LOGI(TAG, "Using SPI peripheral");

sdmmc_host_t host = SDSPI_HOST_DEFAULT();
sdspi_slot_config_t slot_config = SDSPI_SLOT_CONFIG_DEFAULT();
slot_config.gpio_miso = PIN_NUM_MISO;
slot_config.gpio_mosi = PIN_NUM_MOSI;
slot_config.gpio_sck  = PIN_NUM_CLK;
slot_config.gpio_cs   = PIN_NUM_CS;
// This initializes the slot without card detect (CD) and write protect (WP) signals.
// Modify slot_config.gpio_cd and slot_config.gpio_wp if your board has these signals.

endif //USE_SPI_MODE

// Options for mounting the filesystem.
// If format_if_mount_failed is set to true, SD card will be partitioned and
// formatted in case when mounting fails.
esp_vfs_fat_sdmmc_mount_config_t mount_config = {
    .format_if_mount_failed = true,
    .max_files = 5,
    .allocation_unit_size = 16*1024
};

// Use settings defined above to initialize SD card and mount FAT filesystem.
// Note: esp_vfs_fat_sdmmc_mount is an all-in-one convenience function.
// Please check its source code and implement error recovery when developing
// production applications.
sdmmc_card_t* card;
esp_err_t ret = esp_vfs_fat_sdmmc_mount("/sdcard", &host, &slot_config, &mount_config, &card);

if (ret != ESP_OK) {
    if (ret == ESP_FAIL) {
        ESP_LOGE(TAG, "Failed to mount filesystem. "
            "If you want the card to be formatted, set format_if_mount_failed = true.");
    } else {
        ESP_LOGE(TAG, "Failed to initialize the card (%s). "
            "Make sure SD card lines have pull-up resistors in place.", esp_err_to_name(ret));
    }
    return;
}

// Card has been initialized, print its properties
sdmmc_card_print_info(stdout, card);

/************挂载SD卡到系统文件 20181024 end****************/

//Initialize sound source
dd.item_chunk_size = esp_wwe_get_sample_chunksize() * sizeof(int16_t);
dd.recog_queue = xQueueCreate(1, dd.item_chunk_size);
xTaskCreate(&nn_task, "nn", WWE_TASK_STACK, NULL, (CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT - 1), &dd.nn_task_handle);
xTaskCreate(&read_rb_task, "rb read task", WWE_TASK_STACK, NULL, (CONFIG_ESP32_PTHREAD_TASK_PRIO_DEFAULT - 1), NULL);

audio_stream_start(&dd.read_i2s_stream->base);
vTaskDelay(10/portTICK_RATE_MS);
audio_stream_stop(&dd.read_i2s_stream->base);
i2s_set_clk(I2S_NUM_0, SAMP_RATE, SAMP_BITS, I2S_CHANNEL_STEREO);
vTaskDelay(10/portTICK_RATE_MS);
audio_stream_start(&dd.read_i2s_stream->base);
dd.detect_wakeword = true;

}

avsheth commented 5 years ago

@xiaoseyihe can you enable USE_SPI_MODE macro and try again? for SDMMC mode you have to flip switches 1 and 2 ON (JP8)