This is a cache of https://discuss.96boards.org/t/capturing-line-in-audio-via-tiny-cap-on-hikey960-board/6520. It is a snapshot of the page at 2021-06-03T00:01:16.477+0000.
Capturing line-in audio via tiny cap on <strong>hikey</strong>960 board - <strong>hikey</strong> 960 - 96Boards Forum

Capturing line-in audio via tiny cap on hikey960 board

Hello,

I recently got a hikey960 board on which I have installed AOSP master branch along with the standard supplied hikey-kernel.
I Added the tiny cap as a product_package in the hikey/device-common.mk and was trying to capture
line-in audio while I was playing some vide via the browser.
The wav file created by the tiny cap is completely ‘silent’.
The hexdump shows all ‘ff’ in the data section of the wav file .

Can anyone please help here? Is there some change required in the linux kernel to get this running?
Would appreciate any help on this.

Regards
Koushik

That’s not how tinycap works. Tinycap connects to an alsa input device, i.e., a “sound card”. If you want to capture sound you play through a web browser with tinycap, you will have to rig up an alsa loopback device and modify the audio hal to play to it. There are much better, easier, smarter ways to accomplish that.

Thanks for the pointer doitright. After installing the Alsa loop driver, I can record audio with tiny cap but cannot hear the audio via cdmi out!

Heres the output of ‘cards’ in proc file

"
adb shell ‘cat /proc/asound/cards’
0 [Loopback ]: Loopback - Loopback
Loopback 1
1 [hikeysndcard ]: hikey-sndcard - hikey-sndcard
hikey-sndcard
"
Any clue on how to get packets entering loop to also reach the hikeysndcard?

Thanks
Koushik

Pretty sure I told you that you would have to modify your audio hal.

It was blind luck that you were able to capture the intended audio stream as you did with nothing besides enabling loopback. You know why? Because the kernel did NOT have to enumerate the two “cards” in the order they did. The HAL will send audio exclusively to card 0.

yes, saw the CARD hard coded to ‘0’ in the Hal. Modified HAL to output to both the cards and now capture and play are both good. Thanks again.

How to install Alsa loop driver in AOSP ?

CONFIG_SND_ALOOP=y in your kernel config and rebuild.

And read the documentation for the driver to figure out how to set it up.

@doitright, when using “tinycap” to get the wav file,
all the data are zero. Shall I open the “CONFIG_SND_ALOOP=y” or other
config in kernel config file? Thanks.

Hi @doitright,

Can I open and route audio stream to both loopback (say pcmC0D1p) as well as hikey-sndcard(pcmC1D0p) at the same time?