Skip to content

Instantly share code, notes, and snippets.

@fharper
Last active October 2, 2020 19:49
Show Gist options
  • Save fharper/86b25618b23b29e9177ad9f6eefc2585 to your computer and use it in GitHub Desktop.
Save fharper/86b25618b23b29e9177ad9f6eefc2585 to your computer and use it in GitHub Desktop.
Script to convert WAV file from my db9pro audio recorder & move them to Say&Go folder so IFTTT create a Todoist tasks with them
# ensure the path is right
cd /Volumes/RECORD/RECORD
# delete bad files
find . -name "*.WAV" -type 'f' -size -1kb -delete
# batch process the recording
for f in *.WAV;
do
# remove last second (turning off noise)
length=`ffprobe -v 0 -show_entries format=duration -of compact=p=0:nk=1 "$f"`
length=`bc <<< "$length-0.4"`
# encode in mp3
ffmpeg -i "$f" -ss 0 -t "$length" -acodec libmp3lame -y "${f/%WAV/mp3}";
done
# if successful, delete the WAV files & move the MP3 to the Dropbox folder
if [ $? -eq 0 ]; then
rm *.WAV
mv *.mp3 ~/Dropbox/Apps/Say\&Go/
kill -9 $PPID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment