【求助帖】请问V853 TinaSDK如何测试回声消除(AEC)效果?
-
求助帖,望路过的大佬给指点一下,万分感谢
软件SDK: Tina4-V1.2 SDK
硬件平台:百问网V853-AICT开发板
需求:我想要测试一下AEC效果
当前操作过程:我编译运行了external/eyesee-mpp/middleware/sun8iw21/sample/sample_aec例程。程序运行结束后输出的ai_cap.wav只有一个wav头44byte大小。AEC调试记录:
测试过程如下(异常是没有获取到aec后的音频帧,所以结果文件ai_cap.wav只写了个44byte的wav头):
初步定位:sample_aec.c:311行的ret = AW_MPI_AI_GetFrame(pCtx->mAIODev, pCtx->mAIChn, &frame, &stAecFrm, 500);
返回值为ERR_AI_BUF_EMPTY,拿不到音频帧,所以ai_cap.wav输出为空文件。。。root@TinaLinux:/mnt/UDISK# ls bg0.wav lost+found sample_aec sample_aec.conf root@TinaLinux:/mnt/UDISK# cat sample_aec.conf ########### paramter (ref to tulip_cedarx.conf)############ [parameter] pcm_src_path = "/mnt/UDISK/bg0.wav" pcm_dst_path = "/mnt/UDISK/ai_cap.wav" pcm_aec_path = "/mnt/UDISK/ai_aec.wav" pcm_sample_rate = 16000 pcm_channel_cnt = 1 pcm_bit_width = 16 pcm_frame_size = 1024 aec_en = 1 aec_bypass = 0 ans_en = 1 ans_mode = 0 agc_en = 0 agc_gain = 0 add_wav_header = 1 root@TinaLinux:/mnt/UDISK# ./sample_aec -path sample_aec.conf >>>>>>>>>>>>>>>>>>>>>>>>>>>>> Media Process Platform<<<<<<<<<<<<<<<<<<<<<<<<<<<< modName : MPP-Platform tag : V1.0 Release branch: v5-dev commit: 4eed413532ad87725895a8cb1ba75e22fc328233 date : 20170725 author: jenkins [ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<< IPCORE: ISP600 branch: libisp-dev commit: c3bfa4e23fb037123e65a04eaaa39f7876cfe1a6 date : Mon Apr 10 10:37:15 2023 +0800 author: <zhenghanjie@allwinnertech.com> -------------------------------------------------------- I0101 08:27:30.621999 1359 hwdisplay.c:93] <hw_display_init> I0101 08:27:30.622413 1359 hwdisplay.c:1008] <hwd_init> (hwd_init 1008) I0101 08:27:30.622590 1359 hwdisplay.c:1063] <hwd_init> ret[0][2,0]ch[0]lyl[0] init: enable[0], screenwin[0,0, 0x0], zorder[0], alpha[mode:0, value:0] I0101 08:27:41.067487 1359 hwdisplay.c:1077] <hwd_exit> (hwd_exit 1077) root@TinaLinux:/mnt/UDISK# ls ai_cap.wav lost+found sample_aec.conf bg0.wav sample_aec root@TinaLinux:/mnt/UDISK# ll ai_cap.wav -rw-r--r-- 1 root root 44 Jan 1 08:27 ai_cap.wav root@TinaLinux:/mnt/UDISK#
Log如下:
root@TinaLinux:/mnt/UDISK# ls bg0.wav lost+found sample_aec sample_aec.conf root@TinaLinux:/mnt/UDISK# ./sample_aec -path sample_aec.conf I0101 08:44:57.602978 1423 sample_aec.c:537] <main> Hello, sample_aec! I0101 08:44:57.603532 1423 sample_aec.c:123] <ParseCmdLine> sample ao path:[./sample_aec], arg number is [3] I0101 08:44:57.604031 1423 confparser.c:60] <createConfParser> load conf file sample_aec.conf ok! I0101 08:44:57.604217 1423 sample_aec.c:210] <loadSampleAecConfig> config:/mnt/UDISK/bg0.wav-16000-1-1-1-0 I0101 08:44:57.604614 1423 sample_aec.c:492] <ParseWavHeader> Be careful! wav header has chunk:[0x5453494c], size:802, skip I0101 08:44:57.604757 1423 sample_aec.c:583] <main> parse wav header size:854, ChnNum[1], SampleRate[16000], BitsPerSample[16] I0101 08:44:57.604879 1423 mpi_sys.c:842] <AW_MPI_SYS_SetConf> kfctmpdir is [/tmp] >>>>>>>>>>>>>>>>>>>>>>>>>>>>> Media Process Platform<<<<<<<<<<<<<<<<<<<<<<<<<<<< modName : MPP-Platform tag : V1.0 Release branch: v5-dev commit: 4eed413532ad87725895a8cb1ba75e22fc328233 date : 20170725 author: jenkins I0101 08:44:57.608041 1423 mpi_sys.c:1455] <AW_MPI_SYS_Init> ISP init [ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<< IPCORE: ISP600 branch: libisp-dev commit: c3bfa4e23fb037123e65a04eaaa39f7876cfe1a6 date : Mon Apr 10 10:37:15 2023 +0800 author: <zhenghanjie@allwinnertech.com> -------------------------------------------------------- I0101 08:44:57.608318 1423 mpi_sys.c:1457] <AW_MPI_SYS_Init> ISP init done I0101 08:44:57.608639 1423 hwdisplay.c:93] <hw_display_init> I0101 08:44:57.608776 1423 hwdisplay.c:1008] <hwd_init> (hwd_init 1008) I0101 08:44:57.608948 1423 hwdisplay.c:1063] <hwd_init> ret[0][2,0]ch[0]lyl[0] init: enable[0], screenwin[0,0, 0x0], zorder[0], alpha[mode:0, value:0] I0101 08:44:57.649944 1423 audio_hw.c:228] <MakeAllMixerElemsAvailable> pcm open and close, all MixerElems maybe exist. I0101 08:44:57.650145 1423 alsa_interface.c:707] <alsaOpenMixer> open mixer:hw:0 I0101 08:44:57.654989 1423 alsa_interface.c:762] <alsaOpenMixer> set playback vol_val to value: 27 I0101 08:44:57.655528 1423 alsa_interface.c:707] <alsaOpenMixer> open mixer:hw:1 I0101 08:44:57.659887 1423 AOChannel_Component.c:1127] <AOChannel_ComponentInit> create AOChannel threadId[0xb6d19d50] I0101 08:44:57.660155 1423 sample_aec.c:618] <main> create ao channel[0] success! I0101 08:44:57.660454 1431 mpi_sys.c:1073] <MonitorEnvVarThread> detect user environment: I0101 08:44:57.660578 1431 mpi_sys.c:1074] <MonitorEnvVarThread> /tmp/mpp_log_level I0101 08:44:57.660650 1431 mpi_sys.c:1075] <MonitorEnvVarThread> /tmp/mpp_venc_sei_config_param I0101 08:44:57.660859 1433 Clock_Component.c:1117] <Clock_ComponentThread> ClockComp state[0x1]->Idle! I0101 08:44:57.661008 1423 sample_aec.c:657] <main> create clock channel[0] success! I0101 08:44:57.661122 1433 cedarx_avs_counter.c:148] <avscounter_start> (f:avscounter_start, l:148) Avscounter status [pause]->[run], pauseDuration[0][0]ms I0101 08:44:57.661348 1423 alsa_interface.c:1063] <alsaMixerSetVolume> playback setVolume:31, err:0 I0101 08:44:57.661470 1423 alsa_interface.c:990] <alsaMixerSetAudioCodecHubMode> aec_elem_audio_codec_hub_mode:tx hub mode-1 I0101 08:44:57.661611 1423 alsa_interface.c:1013] <alsaMixerSetDAudio0HubMode> aec_elem_daudio0_hub_mode:tx hub mode-1 I0101 08:44:57.661720 1423 alsa_interface.c:1036] <alsaMixerSetDAudio0LoopBackEn> aec_elem_daudio0_loopback_en:loopback debug-1 I0101 08:44:57.661802 1423 alsa_interface.c:873] <alsaMixerSetCapPlaySyncMode> aec_elem_sync_mode_switch:rx sync mode-1 I0101 08:44:57.661893 1423 alsa_interface.c:873] <alsaMixerSetCapPlaySyncMode> aec_elem_sync_mode_switch:rx sync mode-1 I0101 08:44:57.661986 1423 alsa_interface.c:471] <alsaOpenPcm> open pcm! card:[CaptureMic], pcmFlag:[0](0-cap;1-play) I0101 08:44:57.670695 1423 alsa_interface.c:351] <alsaSetPcmParams> set pcm params I0101 08:44:57.671389 1423 alsa_interface.c:432] <alsaSetPcmParams> ----------------ALSA setting---------------- I0101 08:44:57.671531 1423 alsa_interface.c:433] <alsaSetPcmParams> >>Channels: 2, BitWidth: 16,phsical_w: 16, SampRate: 16000 I0101 08:44:57.671614 1423 alsa_interface.c:434] <alsaSetPcmParams> >>ChunkBytes: 4096, ChunkSize: 1024, BufferSize: 8192 I0101 08:44:57.672376 1423 AIChannel_Component.c:1076] <AIChannel_ComponentInit> create AiChannel threadId:0xb6cb0d50 I0101 08:44:57.672622 1423 sample_aec.c:715] <main> create ai channel[0] success! I0101 08:44:57.672943 1423 sample_aec.c:748] <main> pthread create send_pcm_ao_thread[0xb6c8dd50]! I0101 08:44:57.673185 1423 sample_aec.c:758] <main> pthread create send_pcm_ao_thread[0xb6c8dd50]! I0101 08:44:57.674071 1432 AOChannel_Component.c:1642] <AOChannel_ComponentThread> AO get first pcm from ADec, nBufferLen: 2048, nTimeStamp:0us, param[16000-1-0],use it to init AudioRenderHal I0101 08:44:58.005693 1432 AOChannel_Component.c:1653] <AOChannel_ComponentThread> audioDev[0-0] is not config, config it now E0101 08:44:58.005830 1432 audio_hw.c:2082] <audioHw_AO_SetChnPubAttr> ao_set_attr_chl:0,stat:0 I0101 08:44:58.005944 1432 alsa_interface.c:990] <alsaMixerSetAudioCodecHubMode> aec_elem_audio_codec_hub_mode:tx hub mode-1 I0101 08:44:58.006077 1432 alsa_interface.c:1013] <alsaMixerSetDAudio0HubMode> aec_elem_daudio0_hub_mode:tx hub mode-1 I0101 08:44:58.006202 1432 alsa_interface.c:1036] <alsaMixerSetDAudio0LoopBackEn> aec_elem_daudio0_loopback_en:loopback debug-1 I0101 08:44:58.006304 1432 AOChannel_Component.c:1659] <AOChannel_ComponentThread> audioDev[0-0] is not start, start it now E0101 08:44:58.006390 1432 audio_hw.c:2177] <audioHw_AO_EnableChn> ao_enable_chl:0 W0101 08:44:58.006491 1432 audio_hw.c:2220] <audioHw_AO_EnableChn> params of play_daudio0 chn[0] must follow PlaybackRateDmix in asound.conf! [16000-1-960] I0101 08:44:58.006586 1432 alsa_interface.c:471] <alsaOpenPcm> open pcm! card:[hw:1,0], pcmFlag:[1](0-cap;1-play) I0101 08:44:57.673751 1439 sample_aec.c:295] <AiSaveDataThread> AiSaveDataThread cap data file: /mnt/UDISK/ai_cap.wav, dst_fp:0x11f3120 I0101 08:44:58.011462 1432 alsa_interface.c:351] <alsaSetPcmParams> set pcm params I0101 08:44:58.022038 1432 alsa_interface.c:432] <alsaSetPcmParams> ----------------ALSA setting---------------- I0101 08:44:58.022231 1432 alsa_interface.c:433] <alsaSetPcmParams> >>Channels: 1, BitWidth: 16,phsical_w: 16, SampRate: 16000 I0101 08:44:58.022336 1432 alsa_interface.c:434] <alsaSetPcmParams> >>ChunkBytes: 2048, ChunkSize: 1024, BufferSize: 8192 I0101 08:44:58.022434 1432 alsa_interface.c:539] <alsaPreparePcm> prepare pcm I0101 08:44:58.032639 1432 audio_hw.c:2266] <audioHw_AO_EnableChn> daudio0 chn:0 prepare pcm done. I0101 08:44:58.032795 1432 alsa_interface.c:471] <alsaOpenPcm> open pcm! card:[plug:PlaybackRateDmix], pcmFlag:[1](0-cap;1-play) I0101 08:44:58.059717 1432 alsa_interface.c:351] <alsaSetPcmParams> set pcm params I0101 08:44:58.082430 1432 alsa_interface.c:432] <alsaSetPcmParams> ----------------ALSA setting---------------- I0101 08:44:58.082617 1432 alsa_interface.c:433] <alsaSetPcmParams> >>Channels: 1, BitWidth: 16,phsical_w: 16, SampRate: 16000 I0101 08:44:58.082722 1432 alsa_interface.c:434] <alsaSetPcmParams> >>ChunkBytes: 2048, ChunkSize: 1024, BufferSize: 8192 I0101 08:44:58.082812 1432 alsa_interface.c:539] <alsaPreparePcm> prepare pcm I0101 08:44:58.082922 1432 AOChannel_Component.c:1663] <AOChannel_ComponentThread> audio render hal init and run ok:0! W0101 08:44:58.507748 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:44:59.008080 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:44:59.508420 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:00.008745 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:00.509076 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:01.009436 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:01.509773 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:02.010105 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:02.510436 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:03.010768 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:03.511103 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:04.011434 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? W0101 08:45:04.511764 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? I0101 08:45:04.579367 1438 sample_aec.c:402] <SendPcmAoThread> read file finish! I0101 08:45:04.579592 1438 AOChannel_Component.c:172] <AOSetStreamEof> AO end flag is set! drain pcm flag:1! I0101 08:45:04.579739 1432 AOChannel_Component.c:1605] <AOChannel_ComponentThread> A. AOChn[0-0] notify player eof! I0101 08:45:04.579846 1432 AOChannel_Component.c:1608] <AOChannel_ComponentThread> AOChn[0-0] drain pcm ring buf! W0101 08:45:05.012097 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? I0101 08:45:05.091085 1432 AOChannel_Component.c:1621] <AOChannel_ComponentThread> AOChn[0-0] drain pcm ring buf done, cost[511]ms! I0101 08:45:05.091392 1432 sample_aec.c:66] <SampleAec_CallbackWrapper> AO channel notify APP that play complete! I0101 08:45:05.091578 1432 AOChannel_Component.c:1566] <AOChannel_ComponentThread> AO EOF! I0101 08:45:05.180292 1423 sample_aec.c:772] <main> sendPcmAoTid[0xb6c8dd50] is joined! W0101 08:45:05.512420 1439 sample_aec.c:340] <AiSaveDataThread> Be careful! ai getFrame timeout? I0101 08:45:05.512938 1423 sample_aec.c:781] <main> aiSaveDataTidPcm[0xb6c6ad50] is joined! I0101 08:45:05.513210 1433 Clock_Component.c:1117] <Clock_ComponentThread> ClockComp state[0x3]->Idle! I0101 08:45:05.513378 1432 AOChannel_Component.c:1419] <AOChannel_ComponentThread> release all frames to ADec, when state[0x2]->[0x1] I0101 08:45:05.513515 1423 AOChannel_Component.c:896] <AOChannel_ComponentDeInit> wait AO channel component exit!... I0101 08:45:05.513763 1423 AOChannel_Component.c:965] <AOChannel_ComponentDeInit> AO component exited! I0101 08:45:05.513895 1423 audio_hw.c:2350] <audioHw_AO_DisableChn> close pcm! current AoCardType:[0-0] I0101 08:45:05.526581 1423 audio_hw.c:2367] <audioHw_AO_DisableChn> close daudio0 pcm! current AoCardType:[0-0], daudio0:[0-0] E0101 08:45:08.105403 1436 alsa_interface.c:585] <alsaReadPcm> read error: I/O error E0101 08:45:08.105638 1436 audio_hw.c:1006] <audioHw_AI_CapThread> aec fatal error! mainChn fail to read pcm 4096 bytes-2--1 E0101 08:45:08.105772 1436 audio_hw.c:1036] <audioHw_AI_CapThread> Be careful! aec mainChn trigger result[-1] is not -EPIPE. Treated as EPIPE I0101 08:45:08.105880 1436 audio_hw.c:1053] <audioHw_AI_CapThread> aec trigger fail[-1]:[1658080848]us, continue I0101 08:45:08.105960 1436 audio_hw.c:1241] <audioHw_AI_CapThread> AI_CapThread exit! W0101 08:45:08.107680 1423 AIChannel_Component.c:832] <AIChannel_ComponentDeInit> Be careful! aiDev[0]Chn[0] discard audio block num:0, discard audio data len:0 I0101 08:45:08.108138 1423 AIChannel_Component.c:866] <AIChannel_ComponentDeInit> Ai component exited! I0101 08:45:08.108316 1423 alsa_interface.c:810] <alsaCloseMixer> close mixer I0101 08:45:08.108635 1423 alsa_interface.c:810] <alsaCloseMixer> close mixer I0101 08:45:08.108816 1423 hwdisplay.c:1077] <hwd_exit> (hwd_exit 1077) I0101 08:45:08.662381 1431 mpi_sys.c:1080] <MonitorEnvVarThread> MonitorEnvVar thread will exit! I0101 08:45:08.662796 1423 sample_aec.c:810] <main> ./sample_aec test result: success root@TinaLinux:/mnt/UDISK#
我当前的menuconfig配置如下:
我当前的asound.conf配置如下:
pcm.!default { type asym playback.pcm “hw:{CARD=audiocodec, DEV=0}” capture.pcm “hw:0,0” } pcm.PlaybackRateDmix { type plug slave { pcm { type dmix ipc_key 1111 ipc_perm 0666 slave { pcm “hw:0,0” format S16_LE rate 16000 channels 1 period_size 1024 periods 8 } } } rate_converter “linear” } #pcm.resample rely on alsa-plugin and libspeexdsp. Select them in menuconfig if we want to use plugin pcm.resample. pcm.resample { type plug slave { pcm “hw:0,0” format S16_LE rate 16000 channels 1 } rate_converter “speexrate” } pcm.CaptureMic { type hooks slave.pcm “hw:0,0” hooks.0 { type ctl_elems hook_args [ { name “MIC1 Switch” preserve true optional true value 1 } ] } } pcm.eq { type awequal slave.pcm “hw:0,0” config_file “/etc/awequal.conf” tuning_support true
-
menuconfig配置如下:
-
测试过程如下(异常是没有获取到aec后的音频帧,所以结果文件ai_cap.wav只写了个44byte的wav头):
root@TinaLinux:/mnt/UDISK# ls bg0.wav lost+found sample_aec sample_aec.conf root@TinaLinux:/mnt/UDISK# cat sample_aec.conf ########### paramter (ref to tulip_cedarx.conf)############ [parameter] pcm_src_path = "/mnt/UDISK/bg0.wav" pcm_dst_path = "/mnt/UDISK/ai_cap.wav" pcm_aec_path = "/mnt/UDISK/ai_aec.wav" pcm_sample_rate = 16000 pcm_channel_cnt = 1 pcm_bit_width = 16 pcm_frame_size = 1024 aec_en = 1 aec_bypass = 0 ans_en = 1 ans_mode = 0 agc_en = 0 agc_gain = 0 add_wav_header = 1 root@TinaLinux:/mnt/UDISK# ./sample_aec -path sample_aec.conf >>>>>>>>>>>>>>>>>>>>>>>>>>>>> Media Process Platform<<<<<<<<<<<<<<<<<<<<<<<<<<<< modName : MPP-Platform tag : V1.0 Release branch: v5-dev commit: 4eed413532ad87725895a8cb1ba75e22fc328233 date : 20170725 author: jenkins [ISP]>>>>>>>>>>>>>>>>>>>> ISP VERSION INFO <<<<<<<<<<<<<<<<<<< IPCORE: ISP600 branch: libisp-dev commit: c3bfa4e23fb037123e65a04eaaa39f7876cfe1a6 date : Mon Apr 10 10:37:15 2023 +0800 author: <zhenghanjie@allwinnertech.com> -------------------------------------------------------- I0101 08:27:30.621999 1359 hwdisplay.c:93] <hw_display_init> I0101 08:27:30.622413 1359 hwdisplay.c:1008] <hwd_init> (hwd_init 1008) I0101 08:27:30.622590 1359 hwdisplay.c:1063] <hwd_init> ret[0][2,0]ch[0]lyl[0] init: enable[0], screenwin[0,0, 0x0], zorder[0], alpha[mode:0, value:0] I0101 08:27:41.067487 1359 hwdisplay.c:1077] <hwd_exit> (hwd_exit 1077) root@TinaLinux:/mnt/UDISK# ls ai_cap.wav lost+found sample_aec.conf bg0.wav sample_aec root@TinaLinux:/mnt/UDISK# ll ai_cap.wav -rw-r--r-- 1 root root 44 Jan 1 08:27 ai_cap.wav root@TinaLinux:/mnt/UDISK#
-
问题已解决。更换sdk即可
Copyright © 2024 深圳全志在线有限公司 粤ICP备2021084185号 粤公网安备44030502007680号