Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
313 views
in Technique[技术] by (71.8m points)

linux - Tinyalsa/ALSA for Android adjustment. arecord records only noise or nothing

I've installed Alsamixer from Google Play.

Gadget is Samsung Galaxy S3.

It has one soundcard (indexed as 0), and 4 devices (0-3). The device list (from /proc/asound/devices) is the following:

 0: [ 0]   : control
16: [ 0- 0]: digital audio playback
17: [ 0- 1]: digital audio playback
18: [ 0- 2]: digital audio playback
19: [ 0- 3]: digital audio playback
24: [ 0- 0]: digital audio capture
25: [ 0- 1]: digital audio capture
26: [ 0- 2]: digital audio capture
27: [ 0- 3]: digital audio capture
33:        : timer

So pcms list from /dev/snd is

crwxrwxrwx system   audio    116,   0 2014-01-16 12:56 controlC0
crwxrwxrwx system   audio    116,  24 2014-01-16 12:56 pcmC0D0c
crwxrwxrwx system   audio    116,  16 2014-01-16 12:56 pcmC0D0p
crwxrwxrwx system   audio    116,  25 2014-01-16 12:56 pcmC0D1c
crwxrwxrwx system   audio    116,  17 2014-01-16 12:56 pcmC0D1p
crwxrwxrwx system   audio    116,  26 2014-01-16 12:56 pcmC0D2c
crwxrwxrwx system   audio    116,  18 2014-01-16 12:56 pcmC0D2p
crwxrwxrwx system   audio    116,  27 2014-01-16 12:56 pcmC0D3c
crwxrwxrwx system   audio    116,  19 2014-01-16 12:56 pcmC0D3p
crwxrwxrwx system   audio    116,  33 2014-01-16 12:56 timer

alsa_aplay can playback sound ok, but when i try to record it records only noise or emptiness. By experiments i found out that sound can be only 'recorded' with 3-rd device, so the call is:

alsa_aplay -C -D hw:0,3 -r 44100 -f S16_LE -c 1 -d 2 /foo.wav

when hw:0,1 or other is specified i get "pcm_read: read error: invalid argument".

We tried different sampling rates and other arguments.

The same thing happens when i try to record with C-code (jni).

With devices 0-2 it has run-time errors. With device 3 in pcm_read function it infinitely records emptiness.

We use tinyalsa.

Also i tried to manage the devices from Alsamixer app list, i've set most of them into 100% (don't know which stays for the recorder, so set all) but no effect.

Thanks for your response.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...