基于平头哥RVB2601的声纹采集系统
<p><span style="font-family: '微软雅黑'; font-size: 12pt;">在设备监测领域,随着人工智能技术的发展,声纹监测技术近年来日益成熟,声纹监测就是对设备运行过程产生的声音(20Hz~20kHz)进行监测,通过分析软件判断设备运行工况。平头哥</span><span style="font-family: '微软雅黑'; font-size: 12pt;">RVB2601</span><span style="font-family: '微软雅黑'; font-size: 12pt;">开发板拥有双路麦克风、音频code芯片,可以完成</span><span style="font-family: '微软雅黑'; font-size: 12pt;">声纹采集系统</span><span style="font-family: '微软雅黑'; font-size: 12pt;">中最重要的音频采集任务。</span></p><p><span style="font-family: '微软雅黑'; font-size: 12pt;">本次使用的</span><span style="font-family: '微软雅黑'; font-size: 12pt;">RVB2601</span><span style="font-family: '微软雅黑'; font-size: 12pt;">开发板</span><span style="font-family: '微软雅黑'; font-size: 12pt;">基于平头哥CH2601设计,板载JTAG调试器、WiFi芯片W800</span><span style="font-family: '微软雅黑'; font-size: 12pt;">、</span><span style="font-family: '微软雅黑'; font-size: 12pt;">音频</span><span style="font-family: '微软雅黑'; font-size: 12pt;">采集</span><span style="font-family: '微软雅黑'; font-size: 12pt;">ES7210</span><span style="font-family: '微软雅黑'; font-size: 12pt;">、数字麦克风、</span><span style="font-family: '微软雅黑'; font-size: 12pt;">12864 OLED</span><span style="font-family: '微软雅黑'; font-size: 12pt;">显示屏、</span><span style="font-family: '微软雅黑'; font-size: 12pt;">RGB三色灯</span><span style="font-family: '微软雅黑'; font-size: 12pt;">和</span><span style="font-family: '微软雅黑'; font-size: 12pt;">用户按键</span><span style="font-family: '微软雅黑'; font-size: 12pt;">。通过麦克风采集音频经过ES</span><span style="font-family: '微软雅黑'; font-size: 12pt;">7210</span><span style="font-family: '微软雅黑'; font-size: 12pt;">读取到音频PCM数据,添加WAV文件头形成一定时长的wav文件存储到基于本地f</span><span style="font-family: '微软雅黑'; font-size: 12pt;">lash</span><span style="font-family: '微软雅黑'; font-size: 12pt;">的文件系统,运行嵌入式w</span><span style="font-family: '微软雅黑'; font-size: 12pt;">eb</span><span style="font-family: '微软雅黑'; font-size: 12pt;">服务器便于通过浏览器访问播放音频,1</span><span style="font-family: '微软雅黑'; font-size: 12pt;">2864</span><span style="font-family: '微软雅黑'; font-size: 12pt;">和按键、RGB三色灯用于人机交互。</span></p>
<p style="text-align: center; margin-top: 0; margin-bottom: 0;"></p>
<p><span style="font-family: '微软雅黑'; font-size: 12pt;">RVB2601</span><span style="font-family: '微软雅黑'; font-size: 12pt;">通过I</span><span style="font-family: '微软雅黑'; font-size: 12pt;">2C</span><span style="font-family: '微软雅黑'; font-size: 12pt;">接口控制</span><span style="font-family: '微软雅黑'; font-size: 12pt;">ES7210</span><span style="font-family: '微软雅黑'; font-size: 12pt;">,通过I</span><span style="font-family: '微软雅黑'; font-size: 12pt;">2S</span><span style="font-family: '微软雅黑'; font-size: 12pt;">接口读取PCM数据,通过SPI接口与WIFI芯片</span><span style="font-family: '微软雅黑'; font-size: 12pt;"> </span><span style="font-family: '微软雅黑'; font-size: 12pt;">W800通讯</span><span style="font-family: '微软雅黑'; font-size: 12pt;">,通过SPI接口</span><span style="font-family: '微软雅黑'; font-size: 12pt;">控制</span><span style="font-family: '微软雅黑'; font-size: 12pt;">OLED</span><span style="font-family: '微软雅黑'; font-size: 12pt;">屏幕,通过GPIO驱动按键和三色RGB灯</span><span style="font-family: '微软雅黑'; font-size: 12pt;">。</span></p>
<p><span style="font-family: '微软雅黑'; font-size: 12pt;">音频采集代码参考例子c</span><span style="font-family: '微软雅黑'; font-size: 12pt;">h2601_ft_demo</span><span style="font-family: '微软雅黑'; font-size: 12pt;">:</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">void cmd_ft_mic_handler(uint32_t channel_status)</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_error_t ret;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_config_t output_config;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_config_t input_config;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">ret = csi_codec_init(&codec, 0);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">if (ret != CSI_OK) </span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">printf("csi_codec_init error\n");</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">return ;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">codec_output_ch.ring_buf = &output_ring_buffer;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_open(&codec, &codec_output_ch, 0);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">/* output ch config */</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_attach_callback(&codec_output_ch, codec_output_event_cb_fun, NULL);</span></p>
<p> </p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">output_config.bit_width = 16;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">output_config.sample_rate = 8000;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">output_config.buffer = output_buf;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">output_config.buffer_size = OUTPUT_BUF_SIZE;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">output_config.period = 1024;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">output_config.mode = CODEC_OUTPUT_SINGLE_ENDED;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_config(&codec_output_ch, &output_config);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_analog_gain(&codec_output_ch, 0xbf);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_buffer_reset(&codec_output_ch);</span></p>
<p> </p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_link_dma(&codec_output_ch, &dma_ch_output_handle);</span></p>
<p> </p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">codec_input_ch.ring_buf = &input_ring_buffer;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_open(&codec, &codec_input_ch, 0);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">/* input ch config */</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_attach_callback(&codec_input_ch, codec_input_event_cb_fun, NULL);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">input_config.bit_width = 16;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">input_config.sample_rate = 8000;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">input_config.buffer = input_buf;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">input_config.buffer_size = INPUT_BUF_SIZE;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">input_config.period = 1024;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">input_config.mode = CODEC_INPUT_DIFFERENCE;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_config(&codec_input_ch, &input_config);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_analog_gain(&codec_input_ch, 0xbf);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_link_dma(&codec_input_ch, &dma_ch_input_handle);</span></p>
<p> </p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">if (channel_status == 0) </span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">es8156_all_data_left_channel(&es8156_dev);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">else </span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">es8156_all_data_right_channel(&es8156_dev);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">printf("start repeater\n");</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_start(&codec_output_ch);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_start(&codec_input_ch);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">uint32_t times = 0U;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">uint32_t read_size = 0U;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">while (1) </span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">while (new_data_flag < 48) </span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">if (cb_input_transfer_flag) </span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">{</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">read_size = csi_codec_input_read_async(&codec_input_ch, repeater_data_addr + (new_data_flag * 1024), 1024);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">LOGD(TAG,"read size:%d",read_size);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">cb_input_transfer_flag = 0U;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">new_data_flag ++;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">new_data_flag=0;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">led_refresh_low();</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">led_refresh_high();</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">ft_led_refresh();</span></p>
<p> </p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">aos_msleep(100);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">printf("stop repeater\n");</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_stop(&codec_input_ch);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_stop(&codec_output_ch);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_link_dma(&codec_input_ch, NULL);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_link_dma(&codec_output_ch, NULL);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_output_detach_callback(&codec_output_ch);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_input_detach_callback(&codec_input_ch);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">csi_codec_uninit(&codec);</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">return;</span></p>
<p><span style="font-family: 'Courier New'; font-size: 10.5pt;">}</span></p>
<p><span style="font-family: '微软雅黑'; font-size: 16pt;">五、作品源码</span></p>
<p></p>
<p><span style="font-family: '微软雅黑'; font-size: 16pt; font-weight: bold;">六、视频</span><span style="font-family: '微软雅黑'; font-size: 16pt;">演示(视频简介+链接)</span></p>
<p><span style="font-family: '微软雅黑'; font-size: 16pt; font-weight: bold;">七、项目总结(项目文字总结+帖子分享链接汇总)</span></p>
<p><span style="font-family: '微软雅黑'; font-size: 12pt;">非常感谢e</span><span style="font-family: '微软雅黑'; font-size: 12pt;">eword</span><span style="font-family: '微软雅黑'; font-size: 12pt;">和平头哥举办的活动,本次活动体验了平头哥的开发生态,</span><span style="font-family: '微软雅黑'; font-size: 12pt;">aos是十分优秀的RTOS,CDK虽然使用感觉不是很流畅,但是功能十分强大,能够方便快捷的下载、管理软件组件。本来是计划将采集的音频PCM数据增加WAV文件头后存储到文件系统,</span><span style="font-family: '微软雅黑'; font-size: 12pt;">然后运行一个嵌入式w</span><span style="font-family: '微软雅黑'; font-size: 12pt;">eb</span><span style="font-family: '微软雅黑'; font-size: 12pt;">服务器,这样通过浏览器能够访问采集的音频wav文件,</span><span style="font-family: '微软雅黑'; font-size: 12pt;">但是折腾了</span><span style="font-family: '微软雅黑'; font-size: 12pt;">一段时间</span><span style="font-family: '微软雅黑'; font-size: 12pt;">,没有成功的将基于内部f</span><span style="font-family: '微软雅黑'; font-size: 12pt;">lash</span><span style="font-family: '微软雅黑'; font-size: 12pt;">的文件系统调试成功</span><span style="font-family: '微软雅黑'; font-size: 12pt;">,</span><span style="font-family: '微软雅黑'; font-size: 12pt;">因此本次只能采集到PCM音频数据,预期的功能无法实现,</span><span style="font-family: '微软雅黑'; font-size: 12pt;">等后续这方面的资料丰富起来再折腾看看。</span></p>
<p><span style="font-family: '微软雅黑'; font-size: 16pt; font-weight: bold;">八、其他</span></p>
<p></p>
<p> </p>
<p> </p>
功能十分强大了,学习了,谢谢分享! 这个音频采集还是蛮好的,一般来说,声音经过背景去噪滤波,还需要好几步,或者要读特定的话,来确保某些发音都涵盖掉,来满足声纹。 <p>视频看不到 还有其他演示吗 能实现什么效果</p>
页:
[1]