10.音频
10.1 音频接口介绍
以SC-3568HA为例,该板卡的音频接口如下:
10.2 音频测试
使用鸿蒙系统自带的测试命令测试音频是否正常:
录制音频:
1#创建test.wav文件
2~# touch data/test.wav
3
4#录制音频
5~# idl_capture data/test.wav
6==================== Loading Mode ===================
7| 1. Passthrough Loading |
8| 2. IPC Loading |
9======================================================
10Please enter your choice:
112
12================= Audio Input Type ===============
13| 0. mic input type |
14| 1. speech wakeup input type |
15| 2. voice communication input typ |
16| 3. voice recognition input type |
17| 4. voice uplink input type |
18| 5. voice downlink input type |
19| 6. voice call input type |
20| 7. camcorder input type |
21| other. default input type |
22==================================================
23Please enter your choice:
240
25================= Select Audio Card ==================
261. primary
27======================================================
28Please enter your choice:
291
30============== Play Capture select ===========
31| 1. Capture Poll |
32| 2. Capture Interrupt |
33==============================================
34Please enter your choice:
351
36================== Play Capture Menu ==================
37| 1. Capture Start |
38| 2. Capture Stop |
39| 3. Capture Resume |
40| 4. Capture Pause |
41| 5. Capture SetVolume |
42| 6. Capture SetGain |
43| 7. Capture SetMute |
44| 8. Capture SetAttributes |
45| 9. Capture SelectScene |
46| 10. Capture GetExtParams |
47| 11. Capture getMmapPosition |
48| 12.Exit |
49=======================================================
50your choice is:
51
521
53============= Play Capture start Mode ==========
54| 1. Capture non-mmap |
55| 2. Capture mmap |
56================================================
57Please enter your choice:
581
59Start Successful
60================== Play Capture Menu ==================
61| 1. Capture Start |
62| 2. Capture Stop |
63| 3. Capture Resume |
64| 4. Capture Pause |
65| 5. Capture SetVolume |
66| 6. Capture SetGain |
67| 7. Capture SetMute |
68| 8. Capture SetAttributes |
69| 9. Capture SelectScene |
70| 10. Capture GetExtParams |
71| 11. Capture getMmapPosition |
72| 12.Exit |
73=======================================================
74your choice is:
75
76
77Recording,the audio file size is 16Kb
78
79Recording,the audio file size is 512Kb
80
81Recording,the audio file size is 528Kb
82
83Recording,the audio file size is 1024Kb
84
85Recording,the audio file size is 1040Kb
862
87Stop Successful
88================== Play Capture Menu ==================
89| 1. Capture Start |
90| 2. Capture Stop |
91| 3. Capture Resume |
92| 4. Capture Pause |
93| 5. Capture SetVolume |
94| 6. Capture SetGain |
95| 7. Capture SetMute |
96| 8. Capture SetAttributes |
97| 9. Capture SelectScene |
98| 10. Capture GetExtParams |
99| 11. Capture getMmapPosition |
100| 12.Exit |
101=======================================================
102your choice is:
103
10412
105#录制完毕
106Record file path:/data/test.wav
播放音频:
1# idl_render data/test.wav
2==================== Loading Mode ===================
3| 1. Passthrough Loading |
4| 2. IPC Loading |
5======================================================
6Please enter your choice:
72
8================= Select Audio Card ==================
91. primary
10======================================================
11Please enter your choice:
121
13================== Play Render Menu ==================
14| 1. Render Start |
15| 2. Render Stop |
16| 3. Render Resume |
17| 4. Render Pause |
18| 5. Render SetVolume |
19| 6. Render GetGain |
20| 7. Render SetMute |
21| 8. Render SetAttributes |
22| 9. Render SelectScene |
23| 10. Render getEXtParams |
24| 11. Render getMmapPosition |
25| 12.Exit |
26======================================================
27your choice is:
28
291
30Music channels = 2
31Music Rate = 48000 Hz
32Music Bit = 16 bit
33============= Play Render Mode ==========
34| 1. Render non-mmap |
35| 2. Render mmap |
36========================================
37Please enter your choice:
381
39../../drivers/peripheral/audio/test/sample/idl_render.c: [InitPlayingAudioParam]: [386]:[ERROR]:buffer size by calc is 16384
40Start Successful,Music is playing
41================== Play Render Menu ==================
42| 1. Render Start |
43| 2. Render Stop |
44| 3. Render Resume |
45| 4. Render Pause |
46| 5. Render SetVolume |
47| 6. Render GetGain |
48| 7. Render SetMute |
49| 8. Render SetAttributes |
50| 9. Render SelectScene |
51| 10. Render getEXtParams |
52| 11. Render getMmapPosition |
53| 12.Exit |
54======================================================
55your choice is:
56
57
58Play complete, please select input again
59Stop Successful