当前位置:网站首页>Rk3308--8 channels changed to dual channels + recording gain
Rk3308--8 channels changed to dual channels + recording gain
2022-06-10 15:59:00 【Cat teacher NIA~】
Change to dual channel
modify dts file
Related path :
Y:\hxy\RK3308\sdk-1.5\kernel\arch\arm64\boot\dts\rockchipY:\hxy\RK3308\sdk-1.5\kernel\Documentation\devicetree\bindings\soundY:\hxy\RK3308\sdk-1.5\kernel\sound\soc\rockchip
Passing instructions grep -rin "rockchip,rk3308-multi-dais" Find related files
Related documents :
rk3308-evb-dmic-pdm-v13.dtsrockchip,multidais.txtrockchip_multi_dais.c
Modify the following sections :
pdm_i2s_dais: pdm-i2s-dais {
status = "okay";
compatible = "rockchip,rk3308-multi-dais", "rockchip,multi-dais";
dais = <&pdm_8ch>, <&i2s_8ch_2>;
- capture,channel-mapping = <6 2>;
+ capture,channel-mapping = <2 0>;
playback,channel-mapping = <0 2>;
bitclock-inversion = <1 0>;
};
hold <6 2> Change to <2 0>
In limine SDK When I first got it , Is maintaining 8 When compiling firmware during channel configuration , use arecord Instructions cannot be recorded ( After recording, it is found that the data capacity is very small ), And the reason is dts There's one in the file vccio The port is not configured properly :
&io_domains {
status = "okay";
vccio0-supply = <&vcc_io>;
vccio1-supply = <&vcc_io>;
- vccio2-supply = <&vcc_io>;
+ vccio2-supply = <&vcc_1v8>;
vccio3-supply = <&vcc_1v8>;
vccio4-supply = <&vcc_1v8>;
vccio5-supply = <&vcc_io>;
};
from RK_EVB_RK3308_DDR3P116SD4_V13_20181029.pdf You can see each... In the file vccio The role of :
understand asound.conf The role of
route :Y:\hxy\RK3308\sdk-1.5\buildroot\board\rockchip\rk3308\fs-overlay\etc
When I first looked for the path, I found the following 4 A path :
Y:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_release\target\etcY:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_64_dueros\target\etcY:\hxy\RK3308\sdk-1.5\buildroot\board\rockchip\rk3308\fs-overlay\etcY:\hxy\RK3308\sdk-1.5\buildroot\board\minnowboard\fs-overlay-graphical\etc
Related documents :asound.conf and Asound_Configuration_CN.pdf
Recording gain
Gain patch pack patch
route :Y:\hxy\RK3308\sdk-1.5\buildroot\package\alsa-lib
file :0005-add-gain-for-audio-input.patch, There are patches , This is actually out of date , It is required to be changed RK default pcm.c It has been changed , If according to patch If you change the method of the package , The following new :
- 1171 Yes
static void add_gain_rk_16(void* pIn,int length, int channels) - 1205 Yes
static void add_gain_rk_32(void* pIn,int length, int channels) - 2096 Yes
add_gain_rk_16((void*)buffer, tmp * pcm->frame_bits / pcm->sample_bits, pcm->channels);function - 2103 Yes
add_gain_rk_32((void*)buffer, tmp * pcm->frame_bits / pcm->sample_bits, pcm->channels);function
patch Format parsing : Reference link 01 Reference link 02
patch Some contents of the package are parsed as follows :
diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c
index 9c90afb..281fbe3 100644
--- a/src/pcm/pcm.c ## The original document ,a Is the directory corresponding to the original file
+++ b/src/pcm/pcm.c ## Revised document ,b Is the corresponding directory , This file can be found in the lower directory
Here is @@- Number of old file start lines , Number of old lines + Number of new file start lines , Number of new rows @@; Old files from 825 Yes void DCBDoing Start , common 6 That's ok ; The new document is also from 825 OK, let's start , common 23 That's ok :
@@ -825,6 +825,23 @@ void DCBDoing(void* pIn, int length, int channels)
}
}
#endif
+void add_gain(void* pIn, int length, int channels)
+{
+ int i = 0;
+ int16_t * pInBuf = (int16_t *)pIn;
+ char *alsa_gain_level = getenv("ALSA_LIB_ADD_GAIN");
+ if(alsa_gain_level) {
+ int level = atoi(alsa_gain_level);
+ //printf("gain level:%d\n",level);
+ for(i = 0; i < length; i ++ ) {
+ int curChannel = i % channels;
+ if(curChannel < channels - 2 ) {
//audio loopback no need to add gain
+ (*pInBuf) <<= level;
+ }
+ pInBuf++;
+ }
+ }
+}
modify pcm.c
route :Y:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_release\build\alsa-lib-1.1.5\src\pcm
stay 8 When the sound track , The recorded sound is very low , After adding the recording gain patch , Enter commands on the console export ALSA_LIB_ADD_GAIN=4 To achieve recording gain ; When I just changed it to two channels , The above command input on the console is invalid , At this time, we have to be right pcm.c Make changes (notepad++ A quick way to jump to a line :Ctrl+G):
1.2090 That's ok ,snd_pcm_readi There is such a condition in the function :
if(pcm->channels != 2 && tmp > 0){
...}
Change to the following :
if(pcm->channels <= 2 && tmp > 0) {
...}
2. Add one more 2089 One of the lines printf The information is as follows :
printf("dcb size=%d,tmp=%d,sam_bits=%d,framebits=%d,format=%d,channels=%d,\n",size,tmp,pcm->sample_bits,pcm->frame_bits,pcm->format,pcm->channels);
3. Comment out add_gain_rk_16 Functions and add_gain_rk_32 Judgment condition in function :
if(curChannel < channels - 2 ) {
...}
Add the following statements respectively :
printf("rk_16 channels:%d level:%d \n",channels,level);
printf("rk_32 channels:%d level:%d \n",channels,level);
- After a change , Need to go to
cd work/hxy/RK3308/sdk-1.5/buildroot/output/rockchip_rk3308_release/performmake alsa-lib-rebuildcommand - I've tried in
Y:\hxy\RK3308\sdk-1.5\buildroot\output\rockchip_rk3308_release\build\alsa-lib-1.1.5\src\pcmProceed undermake, But it didn't work
mic Hardware circuit diagram
Related documents :EVB_CN.pdf
mic specifications :MSM261D4030H1CPM
6+0+2 Microphone array scheme description
Circular microphone array , For different microphone positions , Different channel combinations can be realized , For example, the scheme in the following figure , Arranged equidistant on the circumference 6 A microphone 
In this microphone array scheme , Circular array microphone can also be designed for voice wake-up function , So there is no need for a separate wake-up microphone . meanwhile , For better echo cancellation , On the left and right channel speaker network , It is provided by the master controller ADC Recover the audio signal at the output end , This mining method can be closest to the actual effect of loudspeaker playing .
therefore 6+0+2 Microphone array means :6 A circular microphone (capture)、0 A wake-up Mike 、2 Road mining (playback) sound signal .
PDM Schematic diagram of microphone
In circuit , Every time 2 One number corresponds to one PDM_SDI The signal , Here's the picture , therefore 6 A wheat needs to be used 3 individual SDI The signal :
Connecting seat
FPC:Flexible Printed Circuit, Flexible printed circuit
The microphone array daughter board passes through 30Pin_0.5mm Spaced FPC Line and RK3308_EVB Motherboard connection , Its interface is defined as follows :
PDM The microphone corresponds to PCB The plate screen printing is : RK_EVB_DMIC-PDM_6C70_V11_20180427J
Console console test
sound recording arecord test
1. First use the following 3 An instruction :
export ALSA_LIB_ADD_GAIN=4arecord -Dhw:0,0 -c 2 -r 8000 -f S16_LE /data/test01.wavaplay /data/test01.wav
Use the following printf Out of log The information is as follows ( It will be commented out in the source code later ):
rk_16 channels:2 level:3
dcb size=1000,tmp=1000,sam_bits=16,framebits=32,format=2,channels=2,
Changed the file system type test
2. If the file system type is changed to ext2 Type words , It can lead to aplay Can't play audio ,arecord Can record ( Yes push Come out and audition )
dts Test of parameter modification significance
problem 1:capture,channel-mapping = <2 0>; Does it mean that only 6 individual mic Medium 2 individual , Which two ?
answer : Through physical tests , Touching on the wheat will make a harsh sound , So we can judge it is mic1 and mic2.
problem 2: It was used mic1 and mic2, Which is the actual recording taken mic The data of ? Which is mic Which one is louder ? Still together ? The software here chooses it by itself ?
answer : Leave through the sound source mic Play far and near , Listen to the difference between the left and right speakers , If it is synthetic , The sound from those two speakers should be the same , Not really , It is mic1 and mic2 Corresponding to the left and right channels of the horn .
problem 3: The manual says PDM Support 8 What does road recording mean ? Because there is only 6 A wheat , There is only 6 The way is right , What are the other two routes for ?
answer : It is possible that the other two routes are simulation mic, Or other input sources , Like headphones .
边栏推荐
- 竟然还有人说ArrayList是2倍扩容,今天带你手撕ArrayList源码
- 2D human posture estimation for posture estimation - numerical coordinate progression with revolutionary neural networks (dsnt)
- Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]
- 自动化运维必备的工具-Shell脚本介绍
- Methods commonly used in uniapp (part) - timestamp problem and rich text parsing image problem
- Apple mailbox configures QQ mailbox, 163 mailbox, edu mailbox, Gmail mailbox, and obtains Gmail calendar
- 使用特定大小、分辨率或背景色保存图窗
- “绽放杯”5G应用奖项大满贯!广和通多个联合项目荣获通用产品专题赛一、二、三等奖
- uniapp中常用到的方法(部分) - 时间戳问题及富文本解析图片问题
- 统一认证中心 Oauth2 认证坑
猜你喜欢

港大、英伟达 | Factuality Enhanced Language Models for Open-Ended Text Generation(用于开放式文本生成的事实性增强语言模型)

Aperçu en direct | déconstruire OLAP! Le nouveau paradigme de l'architecture d'analyse multidimensionnelle est entièrement ouvert! Apache Doris va apporter cinq gros problèmes!

Yuntu says that every successful business system cannot be separated from apig

Save a window with a specific size, resolution, or background color
![2D human pose estimation with residual log likelihood estimation (RLE) [link only]](/img/c7/9c25da07236ef0bd241b6023e82306.gif)
2D human pose estimation with residual log likelihood estimation (RLE) [link only]

Interpretation of cube technology | past and present life of cube Rendering Design

2D human posture estimation for posture estimation - numerical coordinate progression with revolutionary neural networks (dsnt)
![Google x open source grabbing manipulator can find the target part at a glance without manual marking [turn]](/img/69/02a3e0eeaf3049f41b118cf0c58972.jpg)
Google x open source grabbing manipulator can find the target part at a glance without manual marking [turn]

MySQL8安装详细步骤

音视频处理三剑客之 AEC:回声产生原因及回声消除原理
随机推荐
ORB_SLAM2视觉惯性紧耦合定位技术路线与代码详解3——紧耦合优化模型
What has guanghetong done in the three years of 5g business from "seeding in the first generation" to "flower on the ground"?
QT 基于QScrollArea的界面嵌套移动
[untitled]
Guanghetong high computing power intelligent module injects intelligence into 5g c-v2x in the trillion market
百度开源ICE-BA安装运行总结
Google X开源抓取机械臂,无需人工标注就能一眼找到目标零件[转]
kubernetes 二进制安装(v1.20.16)(五)验证 master 部署
剑指 Offer 06. 从尾到头打印链表
【第14节 STL容器二】
安霸CV2FS/CV22FS获得ASIL C芯片功能安全认证,超越市场同类芯片水平
无线通信模组如何助力智能无人机打造“空中物联网”?
"Bloom Cup" 5g Application Award grand slam! Several joint projects of guanghetong won the first, second and third prizes in the general product theme competition
Vins theory and code explanation 0 -- theoretical basis in vernacular
How to improve document management
Detailed installation steps of mysql8
Cube 技术解读 | Cube 渲染设计的前世今生
sm59远程连接,如果提示没有host,则在服务器上加上host,然后重启sap_SAP刘梦
CAP 6.1 版本发布通告
This and object prototypes