JF
]]>Dai
]]>To explain a little you may use bash scripts to do something and you would like it to tell you when it is finished, one way to do this could be a kdialog message box, but as I am not always looking at the screen running the script I wanted an audible notification.
So I went back to a script I created to make my pc talk to my grandchildren which uses a small program called pico2wave
SCRIPT:- /home/dai/bin/say
#!/bin/bash
pico2wave --lang=en-GB -w=/tmp/test.wav "$1"
aplay /tmp/test.wav >/dev/null 2>&1
rm /tmp/test.wav
This script simply says what you type, for example if you type
say "Hello this is your computer talking to you"
It will speak the text you entered
In a script you could use it inside if conditions to notify of the direction a script is going, or pretty much anything really.
I adapted the script a little to save the output to a wav file for use with the sound notifications
SCRIPT:-/home/dai/bin/saytofile
#!/bin/bash
pico2wave --lang=en-GB -w=/home/dai/Documents/Music/Sounds/test.wav "$1"
aplay /home/dai/Documents/Music/Sounds/test.wav >/dev/null 2>&1
This will save the file as test.wav and play it back to you to confirm it sounds ok. What I do is rename the file to something relevant afterwards and then I can use it in system notifications as a greeting or logout or any other sound.
To install pico2wave either use synaptic or from the command line enter
sudo apt-get install libttspico-utils
this will install all that is required to run these scripts as aplay should already be installed.
I hope some of you might find this useful.
Dai
]]>