在Linux 下 开发经常用到tinycap 抓取I2S数据
tinycap 抓取命令如下
-D 表示声卡
-d 表示通道一般为0
-c 表示数据通道
-r表示采样频率 -b 表示采用bit
tinycap /sdcard/test.pcm -D 1 -d 0 -c 8 -r 32000 -b 16 -n 10
tinycap 源码位于RKAndroid12/external/tinyalsa
查看tinyalsa/pcm_hw.c 发现它是使用了ALSA API实现,如果图个简单可以用那个去做写个简洁点的demo网上例子很多
/* tinycap.c
**
** Copyright 2011, The Android Open Source Project
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with