Skip to content

Instantly share code, notes, and snippets.

@varenc
Last active March 5, 2023 08:28
Show Gist options
  • Select an option

  • Save varenc/8cae8f19fede79f63b84cc85f602f382 to your computer and use it in GitHub Desktop.

Select an option

Save varenc/8cae8f19fede79f63b84cc85f602f382 to your computer and use it in GitHub Desktop.

Revisions

  1. varenc revised this gist Dec 8, 2022. 1 changed file with 7 additions and 1 deletion.
    8 changes: 7 additions & 1 deletion siri_recording_save.sh
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,13 @@
    #!/bin/zsh

    ###################
    ### Save all of your Siri recordings on macOS. The recordings will be saved as .wav files in $SIRI_SAVE_DIR
    # Save all of your Siri recordings on macOS. The recordings will be saved as .wav files in $SIRI_SAVE_DIR
    #
    # USAGE:
    # $ wget https://gist.github.com/varenc/8cae8f19fede79f63b84cc85f602f382/raw/siri_recording_save.sh
    # $ chmod +x siri_recording_save.sh
    # $ ./siri_recording_save.sh
    #
    ###################

    SIRI_SAVE_DIR="/tmp/siri_recordings"
  2. varenc revised this gist Dec 8, 2022. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion siri_recording_save.sh
    Original file line number Diff line number Diff line change
    @@ -18,4 +18,4 @@ echo "Watching Siri directory ($SIRI_SOURCE_DIR) now...all new Siri recordings w
    # 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 $HOME/Library/Assistant | grep --line-buffered '.wav$' | xargs -n1 -I {} cp -v {} "$SIRI_SAVE_DIR"
    fswatch -r "$SIRI_SAVE_DIR" | grep --line-buffered '.wav$' | xargs -n1 -I {} cp -v {} "$SIRI_SAVE_DIR"
  3. varenc created this gist Dec 8, 2022.
    21 changes: 21 additions & 0 deletions siri_recording_save.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    #!/bin/zsh

    ###################
    ### Save all of your Siri recordings on macOS. The recordings will be saved as .wav files in $SIRI_SAVE_DIR
    ###################

    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 $HOME/Library/Assistant | grep --line-buffered '.wav$' | xargs -n1 -I {} cp -v {} "$SIRI_SAVE_DIR"