Last active
March 5, 2023 08:28
-
-
Save varenc/8cae8f19fede79f63b84cc85f602f382 to your computer and use it in GitHub Desktop.
Siri on macOS: Copy and save all Siri audio recordings as .wav files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
################### | |
# Save all of your Siri recordings on macOS. The recordings will be saved as .wav files in $SIRI_SAVE_DIR | |
# | |
# USAGE: | |
# $ wget https://gist.githubusercontent.com/varenc/8cae8f19fede79f63b84cc85f602f382/raw/siri_recording_save.sh | |
# $ chmod +x siri_recording_save.sh | |
# $ ./siri_recording_save.sh | |
# | |
################### | |
SIRI_SAVE_DIR="/tmp/siri_recordings" | |
SIRI_SOURCE_DIR="$HOME/Library/Assistant" # You shouldn't need to change this | |
if ! which fswatch > /dev/null ; then echo 'The util 'fswatch' is not installed! Install it with `brew install fswatch`'; exit 1; fi | |
echo "Watching Siri directory ($SIRI_SOURCE_DIR) now...all new Siri recordings will be copied and saved to $SIRI_SAVE_DIR" | |
[ -d "$SIRI_SAVE_DIR" ] || mkdir "$SIRI_SAVE_DIR" | |
# Watch the siri directory for new .wav files. These are streamed to disk as they are recorded. | |
# Once Siri is done the files are deleted, but since we are watching the directory we can copy them immediately | |
# and save them for later. Siri deletes the files soon after they are done recording but our copies will be saved | |
# You will however see a 'No such file or directory' error in the console when Siri is done with each recording. | |
# But check $SIRI_SAVE_DIR and they should be there | |
fswatch -r "$SIRI_SAVE_DIR" | grep --line-buffered '.wav$' | xargs -n1 -I {} cp -v {} "$SIRI_SAVE_DIR" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment