Transcribe voice notes

I began utilizing OpenAi’s whisper AI model to transcribe my voice, which is fantastic for ‘writing’ my thoughts in my diary without having to use my fingers.

I use it to recap progress before going for a break. I just open a shell, type voice-note record some audio and let the model process it in the background while I go grab a snack. The transcribed voice note appears eventually on my daily note file.

OpenAI’s voice recognition Whisper2 model works great in English and English. It does not understand my German. I run it on CPU and it is quite slow, but it does not really matter because to make notes you don’t want to transcribe real time. I guess if you have a GPU/TPU the process is blazing fast.

Add this shell script to your .zshrc/.bashrc etc.

function voice-note() {
  local LANG=${1:-'English'}
  local DATESTAMP=$(date +%Y-%m-%d);
  local TIMESTAMP=$(date +%Y-%m-%d-%H:%M:%S); 
  local JOURNALDIR=~/journal/diary
  local TEMPDIR=$(mktemp -d)

  # Install whisper

  # pip3 install git+

  # How to update whisper.

  # pip3 install --upgrade --no-deps --force-reinstall git+

  # Install arecord

  # apt-get install arecord

  arecord -v -f cd -t raw | lame -r - "${AUDIOFILE}";

  whisper "${AUDIOFILE}" --output_dir /${TEMPDIR} --output_format txt --model small --language ${LANG};

  echo "\n\n# Voice note ${TIMESTAMP}" >> ${JOURNALFILE}
    cat "/${TEMPDIR}/${TIMESTAMP}.txt" >> ${JOURNALFILE}