Record audio with builtin microphone on Orange Pi 3 LTS (Allwinner H6)

Tested on Armbian 22.11.1 Bullseye, kernel 5.15.80-sunxi64.

Mixer settings:

#!/bin/bash

amixer() {
    /usr/bin/amixer "$@"
}

SWITCHES=(
    "Left DAC Mixer ADCL"
    "Left DAC Mixer I2SDACL"
    "Left I2S Mixer ADCL"
    "Left I2S Mixer I2SDACL"
    "Left Input Mixer LINEINL"
    "Left Input Mixer MIC1"
    "Left Input Mixer MIC2"
    "Left Input Mixer OMixerL"
    "Left Input Mixer OMixerR"
    "Left Input Mixer PhoneN"
    "Left Input Mixer PhonePN"
    "Left Output Mixer DACL"
    "Left Output Mixer DACR"
    "Left Output Mixer LINEINL"
    "Left Output Mixer MIC1"
    "Left Output Mixer MIC2"
    "Left Output Mixer PhoneN"
    "Left Output Mixer PhonePN"
    "Right DAC Mixer ADCR"
    "Right DAC Mixer I2SDACR"
    "Right I2S Mixer ADCR"
    "Right I2S Mixer I2SDACR"
    "Right Input Mixer LINEINR"
    "Right Input Mixer MIC1"
    "Right Input Mixer MIC2"
    "Right Input Mixer OMixerL"
    "Right Input Mixer OMixerR"
    "Right Input Mixer PhoneP"
    "Right Input Mixer PhonePN"
    "Right Output Mixer DACL"
    "Right Output Mixer DACR"
    "Right Output Mixer LINEINR"
    "Right Output Mixer MIC1"
    "Right Output Mixer MIC2"
    "Right Output Mixer PhoneP"
    "Right Output Mixer PhonePN"
)

for v in "${SWITCHES[@]}"; do
    value=on
    case "$v" in
        *Input*)
            value=on
            ;;
        *Output*)
            value=off
            ;;
    esac
    amixer set "$v" $value
done

amixer set "Master" "100%"
amixer set "MIC1 Boost" "100%"
amixer set "MIC2 Boost" "100%"
amixer set "Line Out Mixer" "86%"
amixer set "MIC Out Mixer" "71%"

MUTE=(
    "I2S Mixer ADC" 
    "I2S Mixer DAC"
    "ADC Input"
    "DAC Mixer ADC"
    "DAC Mxier DAC" # this is not my typo! https://github.com/SoCXin/H6/blob/dde0a40608fd962a419b2a543a36166cfeb01d04/linux/kernel/sound/soc/codecs/acx00.c#L104
)
for v in "${MUTE[@]}"; do
    amixer set "$v" "0%"
done

Record something (32-bit, mono):

arecord -v -f S32 -r 44100 output.wav

Record and save as mp3:

arecord -v -f S32 -r 44100 -t raw 2>/dev/null | lame -r -s 44.1 -b 192 -m m - output.mp3 >/dev/null 2>/dev/null
If you have any comments, contact me by email.