Alsa

    Record a sample

    arecord --device 'hw:3,0' --duration 5 --format 'S16_LE' >test.mp3
    

    Notes:

    • use arecord -l to list devices. Here we used card 3, subdevice 0. The format depends on device.
    • in case you have an errors with Channels count non available, use -c 2

    Play a sample

    aplay record.mp3
    

    Test microphone (listen your own voice)

    arecord -f S16_LE -c 1 --device="hw:2,0" - | aplay -