XMPP: Dino for Librem 5

recording with arecord

this bash script start recording a wav file until q key is pressed.

–file: arec.sh–

#!/bin/bash                                                                                                                                                   
key="q"
echo "🎤"
arecord -r 16000 --use-strftime ~/%H%M%S%d%m.wav &
pid=$!
while read -n1 char ; do
  if [ "$char" = "$key" ] ; then
      kill "$pid"
      ls *.wav
    break
  fi
done

the --use-strftime is the format to obtain audio file name
The important strftime codes are: %Y is the year, %m month, %d day of the month, %H hour, %M minute and %S second.

make script executable with
chmod +x arec.sh

and put it on $PATH environment or $HOME or any folder you want

from terminal you can start to record with
$ ./path/to/arec.sh

2 Likes