This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Capture mic voice

Other Parts Discussed in Thread: TWL6040

Hi, I'm working on a galaxy nexus with jellybean and I'm trying to insert an audio processing function for using on real time during a voice call.

A normal phone has the following schema for a voice call (This is Really simplified)

UL:         mic -> modem

DL:         modem -> earpiece

What I need is this

UL:         mic -> wav file -> processing -> modem

DL:         modem -> wav file -> processing -> earpiece

I'm using this kernel:

https://android.googlesource.com/kernel/omap.git/+/android-omap-tuna-3.0-jb-mr1.1

To that kernel I applied these patches to enable voice recording capability 

http://review.omapzoom.org/#/c/18442/

http://review.omapzoom.org/#/c/18441/

http://review.omapzoom.org/#/c/18440/

http://review.omapzoom.org/#/c/18439/

I have already implemented the most of the needed configurations using tinymix, but now I have a problem because I can't capture the voice signal from the mic using the omap wiki method "DMic Voice Capture (VX_UL)"

http://www.omappedia.com/wiki/Audio_Drive_Arch#Testing_Audio_Driver 

#break DL
adb shell tinymix 8 0 #DL1 Voice Playback Volume 0
#OK

#cap DL
adb shell tinymix 38 1 #Capture Mixer Voice Playback On
adb shell tinymix 16 120 #VXREC Voice DL Volume 120
adb shell tinymix 55 13 #MUX_UL10 VX Left
adb shell tinymix 54 14 #MUX_UL11 VX Right
adb shell tinycap /sdcard/cap_DL.wav -D 0 -d 1 -c 2 -r 48000 -b 8
#OK

#play on earpiece
adb shell tinyplay /sdcard/cap_DL.wav -D 0 -d 0
#OK

#break UL
adb shell tinymix 20 0 #AUDUL Voice UL Volume 0
#OK

#capturar mic
adb shell tinymix 24 120 #DMIC1 UL Volume 120 120
adb shell tinymix 43 1 #Voice Capture Mixer Capture On
adb shell tinymix 52 1 #MUX_VX1 DMic0L
adb shell tinymix 53 2 #MUX_VX0 DMic0R
adb shell tinycap /sdcard/cap_UL.wav -D 0 -d 2 -c 2 -r 16000 -b 8
#DOESN'T WORK

#play on UL
adb shell tinymix 48 1 #DL1 Mixer Tones On
adb shell tinymix 44 1 #DL2 Mixer Tones On
adb shell tinymix 41 1 #Voice Capture Mixer Tones Playback On
adb shell tinymix 19 120 #AUDUL Tones Volume 120
adb shell tinymix 7 0 #DL1 Tones Playback Volume 0 #Para que no se escuche el .wav en el earpiece origen
adb shell tinyplay /sdcard/cap_UL.wav -D 0 -d 3 # 48k
#OK

This is the output of tinymix:

ctl type num name value
0 ENUM 1 DL1 Equalizer 4Khz LPF 0dB
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 112
7 INT 1 DL1 Tones Playback Volume 0
8 INT 1 DL1 Voice Playback Volume 0
9 INT 1 DL1 Capture Playback Volume 0
10 INT 1 DL2 Media Playback Volume 120
11 INT 1 DL2 Tones Playback Volume 120
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 120
17 INT 1 VXREC Voice UL Volume 0
18 INT 1 AUDUL Media Volume 0
19 INT 1 AUDUL Tones Volume 120
20 INT 1 AUDUL Voice UL Volume 0
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 Off
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 On
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 On
39 BOOL 1 Capture Mixer Voice Capture Off
40 BOOL 1 Capture Mixer Media Playback Off
41 BOOL 1 Voice Capture Mixer Tones Playback On
42 BOOL 1 Voice Capture Mixer Media Playback Off
43 BOOL 1 Voice Capture Mixer Capture On
44 BOOL 1 DL2 Mixer Tones On
45 BOOL 1 DL2 Mixer Voice Off
46 BOOL 1 DL2 Mixer Capture Off
47 BOOL 1 DL2 Mixer Multimedia Off
48 BOOL 1 DL1 Mixer Tones On
49 BOOL 1 DL1 Mixer Voice On
50 BOOL 1 DL1 Mixer Capture Off
51 BOOL 1 DL1 Mixer Multimedia On
52 ENUM 1 MUX_VX1 DMic0L
53 ENUM 1 MUX_VX0 DMic0R
54 ENUM 1 MUX_UL11 VX Right
55 ENUM 1 MUX_UL10 VX Left
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 15 15
68 INT 2 Handsfree Playback Volume 29 29
69 INT 1 Earphone Playback Volume 15
70 ENUM 1 Headset Power Mode High-Performance
71 BOOL 1 Earphone Enable Switch On
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 Main Mic
78 ENUM 1 TWL6040 Power Mode Low-Power

Could you please help me? The only thing I miss is capturing the voice from the mic without changing the other settings because I want all of them to be used simultaneously.

This is the error:

root@android:/ # tinycap /sdcard/cap_UL.wav -D 0 -d 2 -c 2 -r 16000 -b 8
Capturing sample: 2 ch, 16000 hz, 8 bit
start error
Captured 0 frames

Using this configuration everything works except "tinycap /sdcard/cap_UL.wav -D 0 -d 2 -c 2 -r 16000 -b 8", even after doing it, "tinyplay /sdcard/cap_UL.wav -D 0 -d 3" stops working and I have to make a new voice call for it to get fixed.

Thanks a lot.