My goal is to calculate how long it takes to output text to audio when using the say
command.
For example, say
will speak in real time:
$ say -v Alex "Hello there"
I can then combine say
with time
to answer the question in the text, although we have wait until the end of the actual audio output:
$ time say -v Alex "Hello there. How long will this take?"
real 0m2.993s
user 0m0.006s
sys 0m0.009s
- Is there a way to calculate how long it will take to output any
say
command without actually executing it? How? - If not, how can I use
grep
to pull out the real line?
I'm trying something like this:
time say -v Alex "Hello there. How long will this take?" | grep "^real .*$"
But of course there is no result.
Is the output not being passed to grep
, does grep
not work for this multi-line output, or did I use the wrong pattern matching?
If grep
won't work, what will?
UPDATE #1
Actually what I think I'm really looking for is the duration of the generated audio file that results from say
.
grep “real”
?grep "real"
didn't work for me so I tried something else