Page 1 of 1

Shell script trouble: transcribing files with Whisper

PostPosted: Wed Nov 16, 2022 10:35 am
by apkawel
* I use Whisper (https://github.com/openai/whisper) to transcribe audio files.
* The following command works in my terminal:
Code: Select all
(full path)/whisper '(full path)/new.m4a' --model large --language en --fp16 False -o '(full path)/@dictations'

where (full path) means the actual full path to the command, file, or folder (as context requires).

* When I add an audio file of my own speech to a particular folder, I would like Hazel to run the basic command above on that file.
* I created a rule that matches any audio file added to that folder and runs the following embedded shell script for the shell /bin/zsh:
Code: Select all
for f in '$1'; do (full path)/whisper f --model large --language en --fp16 False -o '(full path)/@dictations'; done

* That rule fails, with Hazel reporting the following:
Code: Select all
Shellscript exited with non-successful status code: 1


Before posting, I checked Hazel's Help and made sure that I enclosed $1 in single quotation marks and used the full path of the command. But still no dice.

Am I doing something obviously wrong?

Thank you in advance for your help.

Re: Shell script trouble: transcribing files with Whisper

PostPosted: Wed Nov 16, 2022 10:54 am
by Mr_Noodle
Check to see if whisper requires any environment variables set. You can't assume that they will be set as they are in an interactive Terminal session.

You should also have your script print out everything to help debugging. If you turn on debug mode (https://www.noodlesoft.com/kb/hazel-debug-mode/), it will show that output in the logs.