ADF里面的algorithm例程没有效果

三木哥哥很懵逼
Posts: 3
Joined: Sun Feb 07, 2021 8:52 am

ADF里面的algorithm例程没有效果

Postby 三木哥哥很懵逼 » Mon Nov 01, 2021 11:00 am

最近想试试ADF的回声消除,例程里的algorithm有这个功能,但是我用ESP32-LyraT V4.3和ESP32-LyraT-Mini V1.2运行起来都不正常,没有效果,这是为什么呢?有遇到一样问题的吗?

三木哥哥很懵逼
Posts: 3
Joined: Sun Feb 07, 2021 8:52 am

Re: ADF里面的algorithm例程没有效果

Postby 三木哥哥很懵逼 » Tue Nov 02, 2021 2:35 am

我用的IDF版本是V4.4,发现algorithm例程中不管用哪个开发板都会把算法输入流类型改为type2:
algorithm_stream_cfg_t algo_config = ALGORITHM_STREAM_CFG_DEFAULT();
#if defined CONFIG_ESP_LYRAT_MINI_V1_1_BOARD
algo_config.input_type = ALGORITHM_STREAM_INPUT_TYPE1;
#elif defined CONFIG_ESP_LYRAT_V4_3_BOARD
algo_config.input_type = ALGORITHM_STREAM_INPUT_TYPE2;
#else
ESP_LOGE(TAG, "[ * ] Do not support current board");
return;
#endif
algo_config.input_type = ALGORITHM_STREAM_INPUT_TYPE2;
element_algo = algo_stream_init(&algo_config);

我用的是LYRAT_MINI板子,算法输入流类型改为type1后,发现保存的录音只有播放的音乐声,没有人声,正常应该是没有音乐声只有人声的,十分疑惑

ESP_HengYC
Posts: 184
Joined: Fri Dec 15, 2017 2:45 am

Re: ADF里面的algorithm例程没有效果

Postby ESP_HengYC » Tue Nov 02, 2021 6:37 am

你好,

Code: Select all

     ESP_LOGE(TAG, "[ * ] Do not support current board");
     return;
 #endif
-    algo_config.input_type = ALGORITHM_STREAM_INPUT_TYPE2;
     element_algo = algo_stream_init(&algo_config);
 
     ESP_LOGI(TAG, "[3.2] Create mp3 encoder to encode mp3 format");
@@ -106,7 +105,7 @@ void app_main()
     fatfs_stream_cfg_t fatfs_rd_cfg = FATFS_STREAM_CFG_DEFAULT();
     fatfs_rd_cfg.type = AUDIO_STREAM_READER;
     fatfs_stream_reader = fatfs_stream_init(&fatfs_rd_cfg);
-    
+
     ESP_LOGI(TAG, "[4.2] Create mp3 decoder to decode mp3 file");
     mp3_decoder_cfg_t mp3_decoder_cfg = DEFAULT_MP3_DECODER_CONFIG();
     mp3_decoder = mp3_decoder_init(&mp3_decoder_cfg);
@@ -131,7 +130,7 @@ void app_main()
 #if defined CONFIG_ESP_LYRAT_V4_3_BOARD
     //Please reference the way of ALGORITHM_STREAM_INPUT_TYPE2 in "algorithm_stream.h"
     ringbuf_handle_t input_rb = algo_stream_get_multi_input_rb(element_algo);
-    audio_element_set_multi_output_ringbuf(mp3_decoder, input_rb, 0);
+    audio_element_set_multi_output_ringbuf(i2s_stream_writer, input_rb, 0);
 #endif
 
     ESP_LOGI(TAG, "[5.0] Set up event listener");
@@ -147,7 +146,7 @@ void app_main()
     ESP_LOGI(TAG, "[6.0] Start audio_pipeline");
 
     audio_element_info_t fat_info = {0};
-    audio_element_getinfo(fatfs_stream_writer, &fat_info); 
+    audio_element_getinfo(fatfs_stream_writer, &fat_info);
     fat_info.sample_rates = ALGORITHM_STREAM_DEFAULT_SAMPLE_RATE_HZ;
     fat_info.channels = ALGORITHM_STREAM_DEFAULT_CHANNEL;
     fat_info.bits = ALGORITHM_STREAM_DEFAULT_SAMPLE_BIT;
@@ -160,6 +159,7 @@ void app_main()
 #endif
 
     audio_pipeline_run(pipeline_play);
+    vTaskDelay(25 / portTICK_RATE_MS);  // run play first, reference signal later
     audio_pipeline_run(pipeline_rec);
 
     ESP_LOGI(TAG, "[7.0] Listen for all pipeline events");

请按照上面的修改,测试下效果,谢谢。

Who is online

Users browsing this forum: No registered users and 9 guests