[Miscellaneous Android Development] siljaer:
My fault, actually. The volume level for recordings is high and can result in distorted voice. For a quick fix, edit /etc/mixer_paths_qrd_skuh.xml:

<path name="audio-record">
<ctl name="MultiMedia1 Mixer TERT_MI2S_TX" value="1" />
<!-- set volume to improve audio recordings with handset mic -->
<ctl name="DEC1 Volume" value="120" />
</path>

change 110 (or whatever) with 95 or 100, save and reboot. Actually your feedback would appreciated, as I have never tried voice recognition.

Thank you!

---------- Post added at 12:35 ---------- Previous post was at 12:22 ----------

I have compared logs during phone calls, and I have found something interesting:

Stock rom:

D/voice ( 276): voice_start_usecase: enter usecase:voice-call
D/audio_hw_primary( 276): select_devices: out_snd_device(6: voice-handset) in_snd_device(27: handset-mic)
D/hardware_info( 276): hw_info_append_hw_type : device_name = voice-handset
D/hardware_info( 276): hw_info_append_hw_type : device_name = handset-mic
I/soundtrigger( 276): audio_extn_sound_trigger_update_device_status: device 0x1b of type 1 for Event 1, with Raise=1
V/sound_trigger_hw( 276): handle_audio_concurrency: Enter, event type = 1
D/sound_trigger_platform( 276): platform_stdev_check_and_update_concurrency: concurrency active 0, tx 1, rx 0, concurrency session_allowed 0

CM13:

08-08 11:09:52.156 5582 6796 D voice : voice_start_usecase: enter usecase:voice2-call
08-08 11:09:52.156 5582 6796 V msm8916_platform: platform_get_output_snd_device: enter: output devices(0x1)
08-08 11:09:52.156 5582 6796 V msm8916_platform: platform_get_output_snd_device: exit: snd_device(voice-handset)
08-08 11:09:52.156 5582 6796 V msm8916_platform: platform_get_input_snd_device: enter: out_device(0x1) in_device(0)
08-08 11:09:52.156 5582 6796 V msm8916_platform: platform_get_input_snd_device: exit: in_snd_device(handset-mic)
08-08 11:09:52.156 5582 6796 D audio_hw_primary: select_devices: out_snd_device(9: voice-handset) in_snd_device(34: handset-mic)
08-08 11:09:52.156 5582 6796 V msm8916_platform: platform_check_and_set_codec_backend_cfg usecase = 12
08-08 11:09:52.156 5582 6796 W msm8916_platform: Codec backend bitwidth 16, samplerate 48000
08-08 11:09:52.156 5582 6796 W msm8916_platform: platform_check_codec_backend_cfg:Use default bw and sr for voice/voip calls
08-08 11:09:52.156 5582 6796 V msm8916_platform: platform_set_codec_backend_cfg bw 16, sr 48000
08-08 11:09:52.156 5582 6796 D audio_hw_primary: disable_audio_route: reset and update mixer path: low-latency-playback
08-08 11:09:52.160 5582 6796 D hardware_info: hw_info_append_hw_type : device_name = speaker
08-08 11:09:52.160 5582 6796 D audio_hw_primary: disable_snd_device: snd_device(2: speaker)
08-08 11:09:52.244 5582 6796 D hardware_info: hw_info_append_hw_type : device_name = voice-handset
08-08 11:09:52.244 5582 6796 D audio_hw_primary: enable_snd_device: snd_device(9: voice-handset)
08-08 11:09:52.257 5582 6796 V msm8916_platform: platform_send_audio_calibration: sending audio calibration for snd_device(9) acdb_id(7)

That is, stock rom uses voice-call usecase, while CM13 uses voice2-call.

Unfortunately, I haven't found anything useful on the web so far about these two usecases.

However in mixer_paths:

<path name="voice-call">
<ctl name="PRI_MI2S_RX_Voice Mixer CSVoice" value="1" />
<ctl name="Voice_Tx Mixer TERT_MI2S_TX_Voice" value="1" />
</path>

<path name="voice2-call">
<ctl name="PRI_MI2S_RX_Voice Mixer Voice2" value="1" />
<ctl name="Voice2_Tx Mixer TERT_MI2S_TX_Voice2" value="1" />
</path>

Where CSVoice should stand for Circuit Switched Voice. The two usecases don't look like the same. I can't figure out why CM13 is using voice2-call and how to change that. Well, a brutal way would be:

<path name="voice2-call">
<path name="voice-call">
</path>

But I'd like to understand why CM13 is behaving like that.