This guide explains how to configure sox for recording audio with nerd-dictation.
You may wish to configure sox if you are using a system without pulse-audio support (such as FreeBSD).
Set environment variable AUDIODEV to use a specific input device.
Other sox options can be set (such as gain) by setting environment variable SOX_OPTS.
You can test various devices by
# List audio devices.
arecord -l || cat /proc/asound/cards || cat /dev/sndstat
# Example, use card 2, subdevice 0.
# Record 10 seconds and playback to default output.
AUDIODEV='hw:2,0' sox -d --buffer 1000 -r 16000 -b 16 -e signed-integer -c 1 -t wav -L test.wav trim 0 10
sox test.wav -dTo run nerd-dictation with sox, use the --input argument.
nerd-dictation begin --input=SOX