|
|
|
|
|
by ivansavz
2023 days ago
|
|
I'm pretty proud of this `getvoicerecorder.sh` script that I use to pull .wav voice recordings from my phone, convert them to .mp3, and delete the originals from the phone memory (assuming you have Android Debug Bridge adb tool installed): #!/bin/bash
# On the computer
MYHOME=$HOME
MYDESKTOP=$HOME/Desktop
DEST_DIR="Voice Recordings `date "+%Y-%m-%d"`"
# On the phone
VOICE_RECORDER_SOURCE_DIR="/sdcard/EasyVoiceRecorder"
# 1. make the dest dir and cd into it
cd $MYDESKTOP
mkdir "$DEST_DIR"
cd "$DEST_DIR"
# list files that will be downloaded:
echo "The following files will be adb-pulled, converted, and saved to $DEST_DIR"
adb shell ls "$VOICE_RECORDER_SOURCE_DIR"
# 2. PULL
adb shell "cd $VOICE_RECORDER_SOURCE_DIR; tar -cf allwavs.tar *wav"
adb pull $VOICE_RECORDER_SOURCE_DIR/allwavs.tar allwavs.tar
# 3. PROCESS
tar -xf allwavs.tar
for f in *.wav; do
echo "Converting $f to mp3...";
ffmpeg -hide_banner -loglevel panic -i "$f" "${f%.wav}.mp3";
done
# set timestamp to match what was on the original .wav files
for f in *.wav; do
gtouch -d "$(date -R -r "$f")" "${f%.wav}.mp3";
done
# 4. cleanup
rm *wav
adb shell "rm $VOICE_RECORDER_SOURCE_DIR/allwavs.tar"
rm allwavs.tar
echo "Deleting all .wav files from phone..."
adb shell "rm $VOICE_RECORDER_SOURCE_DIR/*wav"
It's part of a general authoring workflow: whenever I want to write something in a conversational tone (as opposed to dry/technical/academic tone), I go for a walk-and-talk, then transcribe the dictated text + edit. Works really well for intros and conclusions in particular, and blog posts. |
|