Android: How to configure "tinymix" to record system audio with "tinycap"

Martin L. picture Martin L. · May 24, 2012 · Viewed 13.1k times · Source

in Android it's currently impossible to record system-audio with the Android-SDK.

Therefore I played around a bit with TinyALSA (since Android 4) and hope I can reroute the audio-out so I can record it.

When I call "tinymix" on my device I get following configuration:

ctl     type    num     name                                     value
0       ENUM    1       DL1 Equalizer                            Flat response
1       ENUM    1       DL2 Left Equalizer                       450Hz High-pass
2       ENUM    1       DL2 Right Equalizer                      450Hz High-pass
3       ENUM    1       Sidetone Equalizer                       Flat response
4       ENUM    1       AMIC Equalizer                           High-pass 0dB
5       ENUM    1       DMIC Equalizer                           High-pass 0dB
6       INT     1       DL1 Media Playback Volume                120
7       INT     1       DL1 Tones Playback Volume                0
8       INT     1       DL1 Voice Playback Volume                120
9       INT     1       DL1 Capture Playback Volume              0
10      INT     1       DL2 Media Playback Volume                120
11      INT     1       DL2 Tones Playback Volume                0
12      INT     1       DL2 Voice Playback Volume                120
13      INT     1       DL2 Capture Playback Volume              0
14      INT     1       VXREC Media Volume                       0
15      INT     1       VXREC Tones Volume                       0
16      INT     1       VXREC Voice DL Volume                    0
17      INT     1       VXREC Voice UL Volume                    0
18      INT     1       AUDUL Media Volume                       0
19      INT     1       AUDUL Tones Volume                       0
20      INT     1       AUDUL Voice UL Volume                    120
21      INT     1       AUDUL Voice DL Volume                    0
22      INT     1       SDT UL Volume                            103
23      INT     1       SDT DL Volume                            120
24      INT     2       DMIC1 UL Volume                          120 120
25      INT     2       DMIC2 UL Volume                          120 120
26      INT     2       DMIC3 UL Volume                          120 120
27      INT     2       AMIC UL Volume                           120 120
28      INT     2       BT UL Volume                             120 120
29      BOOL    1       DL1 Mono Mixer                           Off
30      BOOL    1       DL2 Mono Mixer                           On
31      BOOL    1       AUDUL Mono Mixer                         Off
32      BOOL    1       DL1 MM_EXT Switch                        Off
33      BOOL    1       DL1 BT_VX Switch                         Off
34      BOOL    1       DL1 PDM Switch                           Off
35      BOOL    1       Sidetone Mixer Capture                   Off
36      BOOL    1       Sidetone Mixer Playback                  On
37      BOOL    1       Capture Mixer Tones                      Off
38      BOOL    1       Capture Mixer Voice Playback             Off
39      BOOL    1       Capture Mixer Voice Capture              Off
40      BOOL    1       Capture Mixer Media Playback             Off
41      BOOL    1       Voice Capture Mixer Tones Playback       Off
42      BOOL    1       Voice Capture Mixer Media Playback       Off
43      BOOL    1       Voice Capture Mixer Capture              Off
44      BOOL    1       DL2 Mixer Tones                          Off
45      BOOL    1       DL2 Mixer Voice                          Off
46      BOOL    1       DL2 Mixer Capture                        Off
47      BOOL    1       DL2 Mixer Multimedia                     On
48      BOOL    1       DL1 Mixer Tones                          Off
49      BOOL    1       DL1 Mixer Voice                          Off
50      BOOL    1       DL1 Mixer Capture                        Off
51      BOOL    1       DL1 Mixer Multimedia                     Off
52      ENUM    1       MUX_VX1                                  None
53      ENUM    1       MUX_VX0                                  None
54      ENUM    1       MUX_UL11                                 None
55      ENUM    1       MUX_UL10                                 None
56      ENUM    1       MUX_UL07                                 None
57      ENUM    1       MUX_UL06                                 None
58      ENUM    1       MUX_UL05                                 None
59      ENUM    1       MUX_UL04                                 None
60      ENUM    1       MUX_UL03                                 None
61      ENUM    1       MUX_UL02                                 None
62      ENUM    1       MUX_UL01                                 None
63      ENUM    1       MUX_UL00                                 None
64      INT     2       Capture Preamplifier Volume              1 1
65      INT     2       Capture Volume                           4 4
66      INT     2       Aux FM Volume                            3 3
67      INT     2       Headset Playback Volume                  9 9
68      INT     2       Handsfree Playback Volume                27 27
69      INT     1       Earphone Playback Volume                 11
70      ENUM    1       Headset Power Mode                       High-Performance
71      BOOL    1       Earphone Enable Switch                   Off
72      ENUM    1       HS Right Playback                        Off
73      ENUM    1       HS Left Playback                         Off
74      ENUM    1       HF Right Playback                        Off
75      ENUM    1       HF Left Playback                         Off
76      ENUM    1       Analog Right Capture Route               Off
77      ENUM    1       Analog Left Capture Route                Off
78      ENUM    1       TWL6040 Power Mode                       Low-Power

Does someone know which parameters I have to set so I can capture the playback (e.g. "multimedia") with "tinycap"?

Sadly there's no documentation available.

Kind regards, Martin M.

Answer

CL. picture CL. · May 30, 2012

Whether you can capture the playback data depends on what hardware you have.

It appears your device has a TWL6040 codec.
Have a look at this chip's documentation to see how its mixer routing works; I'd guess you have to enable some "Capture Mixer"s, probably set some "MUX_UL"s, and maybe set the "Analog Capture Route"s.