ESP32 MIC采集的音频数据怎么保存到SD卡?看到代码中有fopen("/sdcard/rec_debug_1.wav", "w+");创建音频操作,为什么会失败?
离线
格式化了,也不行,需要配置什么吗?我是在duero用例中创建的,看到ESP-ADF中有其他地方在使用fopen("/sdcard/**.wav", "w+");方式,
rec_config_t eng = DEFAULT_REC_ENGINE_CONFIG();
eng.evt_cb = rec_engine_cb;
eng.open = recorder_pipeline_open;
eng.close = recorder_pipeline_close;
eng.fetch = recorder_pipeline_read;
rec_engine_create(&eng);
int retry_time = 1000 / portTICK_PERIOD_MS;
int retry_num = 1;
retry_login_timer = xTimerCreate("tm_duer_login", retry_time,
pdFALSE, NULL, retry_login_timer_cb);
FILE *file = NULL;
//#if RECORD_DEBUG
#if 1
file = fopen("/sdcard/rec_debug_1.wav", "w+");
if (NULL == file) {
//ESP_AUDIO_LOGW(TAG, "open rec_debug_1.wav failed,[%d]", __LINE__);
ESP_LOGE(TAG, "open rec_debug_1.wav failed,[%d]", __LINE__);
}
else
{
ESP_LOGE(TAG, "open rec_debug_1.wav Success,[%d]", __LINE__);
}
离线
我用pipeline_wav_sdcard用了测试,能够正常录音到SD卡,难道ESP32不支持fopen方式保存文件?
离线
离线
@晕哥 感谢指导,刚测试了上面的用例,报出挂载文件系统 错误,你遇到过这个问题吗?
(217) boot: Disabling RNG early entropy source...
I (222) cpu_start: Pro cpu up.
I (226) cpu_start: Starting app cpu, entry point is 0x40080ecc
I (0) cpu_start: App cpu up.
I (236) heap_init: Initializing. RAM available for dynamic allocation:
I (243) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (249) heap_init: At 3FFB3278 len 0002CD88 (179 KiB): DRAM
I (256) heap_init: At 3FFE0440 len 00003BC0 (14 KiB): D/IRAM
I (262) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (268) heap_init: At 40089B5C len 000164A4 (89 KiB): IRAM
I (275) cpu_start: Pro cpu start user code
I (293) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (294) example: Initializing SD card
I (294) example: Using SDMMC peripheral
I (294) gpio: GPIO[13]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
E (334) sdmmc_sd: sdmmc_check_scr: send_scr returned 0xffffffff
E (334) example: Failed to mount filesystem. If you want the card to be formatted, set format_if_mount_failed = true.
离线