Re: say_weather,语音播报天气的脚本(非espeak/festival发音)
发表于 : 2008-10-11 16:14
满屏的大图标表情,胜似水区啊。
写过语音报时的脚本,请自行搜索。shichix 写了:建议写一个语音报时的脚本放入任务栏(省去了双击后选择显示还是运行),点击后报时间。
细节:1。点击一次报时一次,报完后脚本自动退出。2。所报时间为系统时间。3。所报时间可以用“上午“,“下午“以减少语音数据库的文件量。
该程序提供给盲人或视力及差人士使用应该不错的。
能写出语音天气预报,语音报时楼主肯定能写出来是吧?
代码: 全选
user@mojo:~/disk/say_weather$ ./say_weather
北京 22℃~33℃ 下午 晴转多云; 晚上 晴
user@mojo:~/disk/say_weather$
代码: 全选
sudo leafpad ~/disk/say_weather/say_weather
代码: 全选
weather="${weather#* }"
echo ${weather0}
aplay "${wavs_dir}/天气预报" "${wavs_dir}/;" "${wavs_dir}/气温" &> /dev/null
for j in ${weather};do
aplay "${wavs_dir}/$j" &> /dev/null
done
代码: 全选
1、打开终端输入 :cat /dev/audio > file.wav 开始录音
2、停止 : ctrl+c
3、播放 : cat file.wav > /dev/audio
are you sure that you got aplay installed ? if no, try install it. as you have mentioned that running command cat file.wav > /dev/audio works, i suggest you edit the line begins with aplay like this:pityonline 写了:i tried to run it on my smart q5, it showed this:but no sound i could hear.代码: 全选
user@mojo:~/disk/say_weather$ ./say_weather 北京 22℃~33℃ 下午 晴转多云; 晚上 晴 user@mojo:~/disk/say_weather$
then i opened the script with leafpad:i found this in the end:代码: 全选
sudo leafpad ~/disk/say_weather/say_weather
i remembered the command to play the .wav file which i recorded on q5, it's:代码: 全选
weather="${weather#* }" echo ${weather0} aplay "${wavs_dir}/天气预报" "${wavs_dir}/;" "${wavs_dir}/气温" &> /dev/null for j in ${weather};do aplay "${wavs_dir}/$j" &> /dev/null done
it workes very well. then i put 'audio' instead of 'null', save the script and runned it again, it sounded like several 'pa, pa'. so i put 'espeak' instead of 'aplay',(i've already installed espeak.) save and runned it again, but it still played no sounds.代码: 全选
1、打开终端输入 :cat /dev/audio > file.wav 开始录音 2、停止 : ctrl+c 3、播放 : cat file.wav > /dev/audio
well, can anybody help me to work it out on my q5? thanks!
代码: 全选
aplay "${wavs_dir}/$j" &> /dev/null
change into:
cat "${wavs_dir}/$j" > /dev/audio
代码: 全选
user@mojo:~$ sudo apt-get install aplay
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
E: 无法找到软件包 aplay
user@mojo:~$
代码: 全选
user@mojo:~$ sudo apt-cache search aplay
alsa-utils - ALSA utilities
kmplayer - media player for KDE
pulseaudio-utils - Command line tools for the PulseAudio sound server
camediaplay - Still Camera Digital Interface
libsds-dev - development file for libsds
libsomaplayer-dev - development file for libsomaplayer
libsomaplayer0 - primary lib for somaplayer
somaplayer - player audio for the soma suite
somaplayer-doc - documentation for somaplayer
splay - Sound player for MPEG-1,2 layer 1,2,3
gecko-mediaplayer - Media plug-in for Gecko browsers
gnome-mplayer - GNOME MPlayer is a simple GUI for MPlayer
user@mojo:~$
代码: 全选
user@mojo:~$ sudo apt-get install alsa-utils
正在读取软件包列表... 完成
正在分析软件包的依赖关系树
Reading state information... 完成
将会安装下列额外的软件包:
linux-sound-base
推荐安装的软件包:
alsa-base
下列【新】软件包将被安装:
alsa-utils linux-sound-base
共升级了 0 个软件包,新安装了 2 个软件包,要卸载 0 个软件包,有 0 个软件未被升级。
需要下载 1092kB 的软件包。
After this operation, 1995kB of additional disk space will be used.
您希望继续执行吗?[Y/n]y
获取:1 http://repository.handhelds.org hasty/main linux-sound-base 1.0.16-0ubuntu4 [28.8kB]
获取:2 http://repository.handhelds.org hasty/main alsa-utils 1.0.15-3ubuntu2 [1063kB]
下载 1092kB,耗时 22s (48.6kB/s)
debconf: 无法初始化前端界面:Dialog
debconf: (对话框界面要求屏幕画面必须为至少 13 行高及 31 列宽.)
debconf: 返回前端界面:Readline
正在预设定软件包 ...
选中了曾被取消选择的软件包 linux-sound-base。
(正在读取数据库 ... 系统当前总共安装有 41448 个文件和目录。)
正在解压缩 linux-sound-base (从 .../linux-sound-base_1.0.16-0ubuntu4_all.deb) ...
选中了曾被取消选择的软件包 alsa-utils。
正在解压缩 alsa-utils (从 .../alsa-utils_1.0.15-3ubuntu2_arm.deb) ...
正在设置 linux-sound-base (1.0.16-0ubuntu4) ...
debconf: 无法初始化前端界面:Dialog
debconf: (对话框界面要求屏幕画面必须为至少 13 行高及 31 列宽.)
debconf: 返回前端界面:Readline
正在设置 alsa-utils (1.0.15-3ubuntu2) ...
E: Directory '/var/log/apt/' missing
user@mojo:~$
代码: 全选
user@mojo:~$ cd disk/say_weather
user@mojo:~/disk/say_weather$ ls
say_weather say_weather.backup wavs
user@mojo:~/disk/say_weather$ ./say_weather
北京 22℃~34℃ 今晚 晴转多云; 明天 晴
user@mojo:~/disk/say_weather$